{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import time\n",
    "import serial\n",
    "import time\n",
    "import threading\n",
    "\n",
    "# 常量定义\n",
    "BAUD_RATE = 115200\n",
    "MATH_PI=3.1415926535897932"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "通信端口 (COM1) COM1\n",
      "USB-SERIAL CH340 (COM3) COM3\n"
     ]
    }
   ],
   "source": [
    "# 打印所有可用端口\n",
    "import serial.tools.list_ports\n",
    "ports = serial.tools.list_ports.comports()\n",
    "for port in ports:\n",
    "    print(port.description,port.device)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "b'$DGT:1-1,0!\\r\\n{G0001#000P1500T1500!#001P2200T1500!#002P2500T1500!#003P2000T1500!#004P1500T1500!#005P1500T1500!}1500setup_PS2_success\\r\\n'\n",
      "FinishInit\n"
     ]
    }
   ],
   "source": [
    "serport=\"COM3\"\n",
    "serbaud=115200\n",
    "ser=serial.Serial(serport,serbaud)\n",
    "while True:\n",
    "    time.sleep(0.1)\n",
    "    data=ser.read_all()\n",
    "    if data==b'':\n",
    "        continue\n",
    "    if data.find(b'[FinishInit]')!=-1 :\n",
    "        print('FinishInit')\n",
    "        break\n",
    "    else:\n",
    "        print(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 单个电机速度获取\n",
    "motor_number = 9\n",
    "motor_pulses_per_revolution = 0\n",
    "get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "i=0\n",
    "\n",
    "while True:\n",
    "    # make sure every loop running time is 100ms\n",
    "    cur_time = time.time()\n",
    "    print(\"[{:03d}]\".format(i),motor_pulses_per_revolution)\n",
    "    retcode=ser.write(get_speed_cmd.encode())\n",
    "    time.sleep(0.02)\n",
    "    ret=ser.read_all().decode()\n",
    "    print(\"[{:03d}]\".format(i),ret)\n",
    "    i+=1\n",
    "    ret_int=ret[ret.find('=')+1:ret.find('/')]\n",
    "    motor_pulses_per_revolution += int(ret_int)\n",
    "    running_time = time.time() - cur_time\n",
    "    if running_time < 0.1:\n",
    "        # print(\"[NO]\")\n",
    "        time.sleep(0.1 - running_time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Motor pulses per revolution test code\n",
    "running_time_set=0.1\n",
    "motor_number = 9\n",
    "motor_pulses_per_revolutions = [0,0,0,0]\n",
    "get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "i=0\n",
    "motor_pwm=[1500,1500,1500,1500]\n",
    "\n",
    "# use gui control to set motor pwm\n",
    "\n",
    "\n",
    "while True:\n",
    "    # make sure every loop running time is 100ms\n",
    "    cur_time = time.time()\n",
    "    print(\"[{:03d}]\".format(i),motor_pulses_per_revolutions)\n",
    "    for num in range(4):\n",
    "        motor_number=num+6\n",
    "        get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "        retcode=ser.write(get_speed_cmd.encode())\n",
    "        time.sleep(0.015)\n",
    "        ret=ser.read_all().decode()\n",
    "        # print(\"[{:03d}]\".format(i),ret)\n",
    "        ret_int=ret[ret.find('=')+1:ret.find('/')]\n",
    "        motor_pulses_per_revolutions[num] += int(ret_int)\n",
    "    i+=1\n",
    "    \n",
    "    running_time = time.time() - cur_time\n",
    "    if running_time < running_time_set:\n",
    "        print(\"[NO]\",running_time)\n",
    "        time.sleep(running_time_set - running_time)\n",
    "    else:\n",
    "        print(\"[OVER]\",running_time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[000] [0, 0, 0, 0]\n",
      "[NO]\n",
      "Timer unit: 1e-07 s\n",
      "\n",
      "Total time: 0.10989 s\n",
      "File: C:\\Users\\ChZT\\AppData\\Local\\Temp\\ipykernel_31164\\1161404949.py\n",
      "Function: fun at line 2\n",
      "\n",
      "Line #      Hits         Time  Per Hit   % Time  Line Contents\n",
      "==============================================================\n",
      "     2                                           def fun():\n",
      "     3                                               # Motor pulses per revolution test code\n",
      "     4         1          3.0      3.0      0.0      running_time_set=0.1\n",
      "     5         1          2.0      2.0      0.0      motor_number = 9\n",
      "     6         1          3.0      3.0      0.0      motor_pulses_per_revolutions = [0,0,0,0]\n",
      "     7         1         44.0     44.0      0.0      get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
      "     8         1          2.0      2.0      0.0      i=0\n",
      "     9                                           \n",
      "    10         2         50.0     25.0      0.0      while not i:\n",
      "    11                                                   # make sure every loop running time is 100ms\n",
      "    12         1         13.0     13.0      0.0          cur_time = time.time()\n",
      "    13         1       2629.0   2629.0      0.2          print(\"[{:03d}]\".format(i),motor_pulses_per_revolutions)\n",
      "    14         5         49.0      9.8      0.0          for num in range(4):\n",
      "    15         4         19.0      4.8      0.0              motor_number=num+6\n",
      "    16         4        292.0     73.0      0.0              get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
      "    17         4       6254.0   1563.5      0.6              retcode=ser.write(get_speed_cmd.encode())\n",
      "    18         4     620989.0 155247.2     56.5              time.sleep(0.015)\n",
      "    19         4       5281.0   1320.2      0.5              ret=ser.read_all().decode()\n",
      "    20                                                       # print(\"[{:03d}]\".format(i),ret)\n",
      "    21         4        234.0     58.5      0.0              ret_int=ret[ret.find('=')+1:ret.find('/')]\n",
      "    22         4        219.0     54.8      0.0              motor_pulses_per_revolutions[num] += int(ret_int)\n",
      "    23         1          4.0      4.0      0.0          i+=1\n",
      "    24                                                   \n",
      "    25         1         37.0     37.0      0.0          running_time = time.time() - cur_time\n",
      "    26         1          4.0      4.0      0.0          if running_time < running_time_set:\n",
      "    27         1        253.0    253.0      0.0              print(\"[NO]\")\n",
      "    28         1     462514.0 462514.0     42.1              time.sleep(running_time_set - running_time)\n",
      "    29                                                   else:\n",
      "    30                                                       print(\"[OVER]\",running_time)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "# 代码运行时间分析\n",
    "def fun():\n",
    "    # Motor pulses per revolution test code\n",
    "    running_time_set=0.1\n",
    "    motor_number = 9\n",
    "    motor_pulses_per_revolutions = [0,0,0,0]\n",
    "    get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "    i=0\n",
    "\n",
    "    while not i:\n",
    "        # make sure every loop running time is 100ms\n",
    "        cur_time = time.time()\n",
    "        print(\"[{:03d}]\".format(i),motor_pulses_per_revolutions)\n",
    "        for num in range(4):\n",
    "            motor_number=num+6\n",
    "            get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "            retcode=ser.write(get_speed_cmd.encode())\n",
    "            time.sleep(0.015)\n",
    "            ret=ser.read_all().decode()\n",
    "            # print(\"[{:03d}]\".format(i),ret)\n",
    "            ret_int=ret[ret.find('=')+1:ret.find('/')]\n",
    "            motor_pulses_per_revolutions[num] += int(ret_int)\n",
    "        i+=1\n",
    "        \n",
    "        running_time = time.time() - cur_time\n",
    "        if running_time < running_time_set:\n",
    "            print(\"[NO]\")\n",
    "            time.sleep(running_time_set - running_time)\n",
    "        else:\n",
    "            print(\"[OVER]\",running_time)\n",
    "            \n",
    "profile = lp.LineProfiler(fun)\n",
    "profile.enable()\n",
    "# 起始分析\n",
    "fun()\n",
    "# 调用函数，这里还是正常传入参数的哦\n",
    "profile.disable()\n",
    "# 停止分析，这里就相当于只分析get_url_txt这个函数\n",
    "profile.print_stats()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "通信端口 (COM1) COM1\n",
      "USB-SERIAL CH340 (COM3) COM3\n",
      "b'$DGT:1-1,0!\\r\\n{G0001#000P1500T1500!#001P2200T1500!#002P2500T1500!#003P2000T1500!#004P1500T1500!#005P1500T1500!}1500setup_PS2_success\\r\\n'\n",
      "FinishInit\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 1]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 28]\n",
      "[0, 0, 0, 39]\n",
      "[0, 0, 0, 46]\n",
      "[0, 0, 0, 46]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 50]\n",
      "[0, 0, 0, 50]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 50]\n",
      "[0, 0, 0, 50]\n",
      "[0, 0, 0, 50]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 47]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 47]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 50]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 50]\n",
      "[0, 0, 0, 50]\n",
      "[0, 0, 0, 49]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 72]\n",
      "[0, 0, 0, 106]\n",
      "[0, 0, 0, 113]\n",
      "[0, 0, 0, 113]\n",
      "[0, 0, 0, 117]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 117]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 118]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 118]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 118]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 118]\n",
      "[0, 0, 0, 118]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 119]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 123]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 120]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 122]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 121]\n",
      "[0, 0, 0, 117]\n",
      "[0, 0, 0, 117]\n",
      "[0, 0, 0, 116]\n",
      "[0, 0, 0, 113]\n",
      "[0, 0, 0, 109]\n",
      "[0, 0, 0, 103]\n",
      "[0, 0, 0, 97]\n",
      "[0, 0, 0, 91]\n",
      "[0, 0, 0, 84]\n",
      "[0, 0, 0, 80]\n",
      "[0, 0, 0, 76]\n",
      "[0, 0, 0, 71]\n",
      "[0, 0, 0, 63]\n",
      "[0, 0, 0, 53]\n",
      "[0, 0, 0, 40]\n",
      "[0, 0, 0, 28]\n",
      "[0, 0, 0, 28]\n",
      "[0, 0, 0, 18]\n",
      "[0, 0, 0, 10]\n",
      "[0, 0, 0, 6]\n",
      "[0, 0, 0, 6]\n",
      "[0, 0, 0, 8]\n",
      "[0, 0, 0, 9]\n",
      "[0, 0, 0, 9]\n",
      "[0, 0, 0, 10]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 6]\n",
      "[0, 0, 0, 1]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 6]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 14]\n",
      "[0, 0, 0, 14]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 15]\n",
      "[0, 0, 0, 20]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 8]\n",
      "[0, 0, 0, 1]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 4]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 14]\n",
      "[0, 0, 0, 14]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 10]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 13]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 14]\n",
      "[0, 0, 0, 19]\n",
      "[0, 0, 0, 18]\n",
      "[0, 0, 0, 7]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 19]\n",
      "[0, 0, 0, 19]\n",
      "[0, 0, 0, 66]\n",
      "[0, 0, 0, 66]\n",
      "[0, 0, 0, 82]\n",
      "[0, 0, 0, 82]\n",
      "[0, 0, 0, 83]\n",
      "[0, 0, 0, 85]\n",
      "[0, 0, 0, 86]\n",
      "[0, 0, 0, 84]\n",
      "[0, 0, 0, 81]\n",
      "[0, 0, 0, 70]\n",
      "[0, 0, 0, 60]\n",
      "[0, 0, 0, 53]\n",
      "[0, 0, 0, 48]\n",
      "[0, 0, 0, 42]\n",
      "[0, 0, 0, 34]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 14]\n",
      "[0, 0, 0, 10]\n",
      "[0, 0, 0, 8]\n",
      "[0, 0, 0, 8]\n",
      "[0, 0, 0, 8]\n",
      "[0, 0, 0, 10]\n",
      "[0, 0, 0, 11]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 12]\n",
      "[0, 0, 0, 14]\n",
      "[0, 0, 0, 18]\n",
      "[0, 0, 0, 21]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 26]\n",
      "[0, 0, 0, 26]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 25]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 22]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 23]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 24]\n",
      "[0, 0, 0, 23]\n"
     ]
    }
   ],
   "source": [
    "# 实时转速测试\n",
    "\n",
    "import serial\n",
    "import time\n",
    "import threading\n",
    "motor_pwm=[1500,1500,1500,1500]\n",
    "motor_pulses_per_revolutions = [0,0,0,0]\n",
    "\n",
    "# list all serial ports available on the system\n",
    "import serial.tools.list_ports\n",
    "ports = serial.tools.list_ports.comports()\n",
    "for port in ports:\n",
    "    print(port.description,port.device)\n",
    "\n",
    "serport=\"COM3\"\n",
    "serbaud=115200\n",
    "running=True\n",
    "ser=serial.Serial(serport,serbaud)\n",
    "while True:\n",
    "    time.sleep(0.1)\n",
    "    data=ser.read_all()\n",
    "    if data==b'':\n",
    "        continue\n",
    "    if data.find(b'[FinishInit]')!=-1 :\n",
    "        print('FinishInit')\n",
    "        break\n",
    "    else:\n",
    "        print(data)\n",
    "\n",
    "def fun():\n",
    "    # Motor pulses per revolution test code\n",
    "    running_time_set=0.1\n",
    "    motor_number = 9\n",
    "    \n",
    "    get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "    i=0\n",
    "    \n",
    "    start_time=time.time()\n",
    "\n",
    "    while True:\n",
    "        if not running:\n",
    "            break\n",
    "        # make sure every loop running time is 100ms\n",
    "        cur_time = time.time()\n",
    "        spd_set_cmd=\"{{#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!}}\".format(6,motor_pwm[0],7,motor_pwm[1],8,motor_pwm[2],9,motor_pwm[3])\n",
    "        # print(spd_set_cmd)\n",
    "        retcode=ser.write(spd_set_cmd.encode())\n",
    "        time.sleep(0.015)\n",
    "        ret=ser.read_all().decode()\n",
    "        # print(ret)\n",
    "        # print(\"[{:03d}]\".format(i),motor_pulses_per_revolutions)\n",
    "        for num in range(4):\n",
    "            motor_number=num+6\n",
    "            get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "            retcode=ser.write(get_speed_cmd.encode())\n",
    "            time.sleep(0.015)\n",
    "            ret=ser.read_all().decode()\n",
    "            # print(\"[{:03d}]\".format(i),ret)\n",
    "            ret_int=ret[ret.find('=')+1:ret.find('/')]\n",
    "            motor_pulses_per_revolutions[num] = int(ret_int)\n",
    "        i+=1\n",
    "        print(motor_pulses_per_revolutions)\n",
    "        \n",
    "        running_time = time.time() - cur_time\n",
    "        if running_time < running_time_set:\n",
    "            # print(\"[NO]\")\n",
    "            time.sleep(running_time_set - running_time)\n",
    "        else:\n",
    "            # print(\"[OVER]\",running_time)\n",
    "            pass\n",
    "\n",
    "#创建一个线程，执行fun函数\n",
    "t=threading.Thread(target=fun)\n",
    "t.start()\n",
    "import tkinter as tk\n",
    "\n",
    "# motor_pwm=[1500, 1500, 1500, 1500]\n",
    "\n",
    "def main():\n",
    "    def update_motor_pwm(event):\n",
    "        global motor_pwm\n",
    "        # 获取滑块的值并更新motor_pwm\n",
    "        motor_pwm = [scale1.get(), scale2.get(), scale3.get(), scale4.get()]\n",
    "        # print(f\"Motor PWM Values: {motor_pwm}\")\n",
    "\n",
    "    # 创建主窗口\n",
    "    root = tk.Tk()\n",
    "    root.title(\"Motor PWM Control\")\n",
    "\n",
    "    # 创建四个滑块\n",
    "    scale1 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 1 PWM\")\n",
    "    scale1.set(1500)  # 设置初始值\n",
    "    scale1.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale2 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 2 PWM\")\n",
    "    scale2.set(1500)  # 设置初始值\n",
    "    scale2.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale3 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 3 PWM\")\n",
    "    scale3.set(1500)  # 设置初始值\n",
    "    scale3.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale4 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 4 PWM\")\n",
    "    scale4.set(1500)  # 设置初始值\n",
    "    scale4.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    # 创建一个按钮，用于更新motor_pwm值\n",
    "    update_button = tk.Button(root, text=\"Update PWM\", command=update_motor_pwm)\n",
    "    update_button.pack(pady=10)\n",
    "\n",
    "    # 绑定事件处理函数:当滑块的值发生变化时，调用update_motor_pwm函数\n",
    "    scale1.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale2.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale3.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale4.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "\n",
    "    # 创建一个标签，用于显示当前的motor_pulses_per_revolutions值\n",
    "    label = tk.Label(root, text=\"Motor Pulses Per Revolutions:\")\n",
    "    label.pack(pady=10)\n",
    "    # 每隔100ms更新一次label显示的值\n",
    "    def update_label():\n",
    "        # 获取当前的motor_pulses_per_revolutions值\n",
    "        global motor_pulses_per_revolutions\n",
    "        label.config(text=f\"{motor_pulses_per_revolutions}\")\n",
    "        # 再次调用本函数，以便于每隔100ms更新一次label显示的值\n",
    "        root.after(100, update_label)\n",
    "\n",
    "    # 运行主循环\n",
    "    root.mainloop()\n",
    "\n",
    "    running=False\n",
    "    time.sleep(0.5)\n",
    "\n",
    "    #程序结束，停止线程\n",
    "    t.join()\n",
    "\n",
    "    # 关闭串口\n",
    "    ser.close()\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    main()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "通信端口 (COM1) COM1\n",
      "USB-SERIAL CH340 (COM3) COM3\n",
      "b'$DGT:1-1,0!\\r\\n{G0001#000P1500T1500!#001P2200T1500!#002P2500T1500!#003P2000T1500!#004P1500T1500!#005P1500T1500!}1500setup_PS2_success\\r\\n'\n",
      "FinishInit\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 0]\n",
      "[0, 0, 0, 7]\n",
      "[0, 0, 0, 39]\n",
      "[0, 0, 0, 87]\n",
      "[0, 0, 0, 143]\n",
      "[0, 0, 0, 201]\n",
      "[0, 0, 0, 262]\n",
      "[0, 0, 0, 324]\n",
      "[0, 0, 0, 386]\n",
      "[0, 0, 0, 448]\n",
      "[0, 0, 0, 510]\n",
      "[0, 0, 0, 572]\n",
      "[0, 0, 0, 632]\n",
      "[0, 0, 0, 691]\n",
      "[0, 0, 0, 752]\n",
      "[0, 0, 0, 811]\n",
      "[0, 0, 0, 870]\n",
      "[0, 0, 0, 929]\n",
      "[0, 0, 0, 988]\n",
      "[0, 0, 0, 1049]\n",
      "[0, 0, 0, 1110]\n",
      "[0, 0, 0, 1171]\n",
      "[0, 0, 0, 1233]\n",
      "[0, 0, 0, 1294]\n",
      "[0, 0, 0, 1355]\n",
      "[0, 0, 0, 1414]\n",
      "[0, 0, 0, 1474]\n",
      "[0, 0, 0, 1533]\n",
      "[0, 0, 0, 1593]\n",
      "[0, 0, 0, 1653]\n",
      "[0, 0, 0, 1706]\n",
      "[0, 0, 0, 1759]\n",
      "[0, 0, 0, 1793]\n",
      "[0, 0, 0, 1818]\n",
      "[0, 0, 0, 1843]\n",
      "[0, 0, 0, 1863]\n",
      "[0, 0, 0, 1883]\n",
      "[0, 0, 0, 1903]\n",
      "[0, 0, 0, 1926]\n",
      "[0, 0, 0, 1949]\n",
      "[0, 0, 0, 1972]\n",
      "[0, 0, 0, 1996]\n",
      "[0, 0, 0, 2020]\n",
      "[0, 0, 0, 2043]\n",
      "[0, 0, 0, 2066]\n",
      "[0, 0, 0, 2089]\n",
      "[0, 0, 0, 2106]\n",
      "[0, 0, 0, 2123]\n",
      "[0, 0, 0, 2128]\n",
      "[0, 0, 0, 2129]\n",
      "[0, 0, 0, 2129]\n",
      "[0, 0, 0, 2129]\n",
      "[0, 0, 0, 2132]\n",
      "[0, 0, 0, 2142]\n",
      "[0, 0, 0, 2153]\n",
      "[0, 0, 0, 2166]\n",
      "[0, 0, 0, 2181]\n",
      "[0, 0, 0, 2195]\n",
      "[0, 0, 0, 2208]\n",
      "[0, 0, 0, 2220]\n",
      "[0, 0, 0, 2232]\n",
      "[0, 0, 0, 2244]\n",
      "[0, 0, 0, 2256]\n",
      "[0, 0, 0, 2267]\n",
      "[0, 0, 0, 2277]\n",
      "[0, 0, 0, 2288]\n",
      "[0, 0, 0, 2299]\n",
      "[0, 0, 0, 2310]\n",
      "[0, 0, 0, 2322]\n",
      "[0, 0, 0, 2335]\n",
      "[0, 0, 0, 2347]\n",
      "[0, 0, 0, 2358]\n",
      "[0, 0, 0, 2369]\n",
      "[0, 0, 0, 2381]\n",
      "[0, 0, 0, 2393]\n",
      "[0, 0, 0, 2404]\n",
      "[0, 0, 0, 2416]\n",
      "[0, 0, 0, 2428]\n",
      "[0, 0, 0, 2441]\n",
      "[0, 0, 0, 2452]\n",
      "[0, 0, 0, 2463]\n",
      "[0, 0, 0, 2475]\n",
      "[0, 0, 0, 2487]\n",
      "[0, 0, 0, 2499]\n",
      "[0, 0, 0, 2511]\n",
      "[0, 0, 0, 2522]\n",
      "[0, 0, 0, 2533]\n",
      "[0, 0, 0, 2545]\n",
      "[0, 0, 0, 2557]\n",
      "[0, 0, 0, 2569]\n",
      "[0, 0, 0, 2581]\n",
      "[0, 0, 0, 2592]\n",
      "[0, 0, 0, 2603]\n",
      "[0, 0, 0, 2615]\n",
      "[0, 0, 0, 2627]\n",
      "[0, 0, 0, 2638]\n",
      "[0, 0, 0, 2649]\n",
      "[0, 0, 0, 2661]\n",
      "[0, 0, 0, 2673]\n",
      "[0, 0, 0, 2685]\n",
      "[0, 0, 0, 2697]\n",
      "[0, 0, 0, 2709]\n",
      "[0, 0, 0, 2720]\n",
      "[0, 0, 0, 2731]\n",
      "[0, 0, 0, 2742]\n",
      "[0, 0, 0, 2754]\n",
      "[0, 0, 0, 2766]\n",
      "[0, 0, 0, 2778]\n",
      "[0, 0, 0, 2789]\n",
      "[0, 0, 0, 2800]\n",
      "[0, 0, 0, 2812]\n",
      "[0, 0, 0, 2825]\n",
      "[0, 0, 0, 2837]\n",
      "[0, 0, 0, 2849]\n",
      "[0, 0, 0, 2860]\n",
      "[0, 0, 0, 2871]\n",
      "[0, 0, 0, 2883]\n",
      "[0, 0, 0, 2895]\n",
      "[0, 0, 0, 2907]\n",
      "[0, 0, 0, 2919]\n",
      "[0, 0, 0, 2930]\n",
      "[0, 0, 0, 2941]\n",
      "[0, 0, 0, 2953]\n",
      "[0, 0, 0, 2965]\n",
      "[0, 0, 0, 2977]\n",
      "[0, 0, 0, 2989]\n",
      "[0, 0, 0, 3001]\n",
      "[0, 0, 0, 3013]\n",
      "[0, 0, 0, 3024]\n",
      "[0, 0, 0, 3035]\n",
      "[0, 0, 0, 3045]\n",
      "[0, 0, 0, 3056]\n",
      "[0, 0, 0, 3068]\n",
      "[0, 0, 0, 3080]\n",
      "[0, 0, 0, 3092]\n",
      "[0, 0, 0, 3104]\n",
      "[0, 0, 0, 3115]\n",
      "[0, 0, 0, 3126]\n",
      "[0, 0, 0, 3137]\n",
      "[0, 0, 0, 3148]\n",
      "[0, 0, 0, 3160]\n",
      "[0, 0, 0, 3172]\n",
      "[0, 0, 0, 3184]\n",
      "[0, 0, 0, 3196]\n",
      "[0, 0, 0, 3208]\n",
      "[0, 0, 0, 3220]\n",
      "[0, 0, 0, 3232]\n",
      "[0, 0, 0, 3244]\n",
      "[0, 0, 0, 3256]\n",
      "[0, 0, 0, 3268]\n",
      "[0, 0, 0, 3279]\n",
      "[0, 0, 0, 3290]\n",
      "[0, 0, 0, 3301]\n",
      "[0, 0, 0, 3313]\n",
      "[0, 0, 0, 3325]\n",
      "[0, 0, 0, 3337]\n",
      "[0, 0, 0, 3349]\n",
      "[0, 0, 0, 3361]\n",
      "[0, 0, 0, 3372]\n",
      "[0, 0, 0, 3383]\n",
      "[0, 0, 0, 3394]\n",
      "[0, 0, 0, 3406]\n",
      "[0, 0, 0, 3418]\n",
      "[0, 0, 0, 3429]\n",
      "[0, 0, 0, 3441]\n",
      "[0, 0, 0, 3453]\n",
      "[0, 0, 0, 3465]\n",
      "[0, 0, 0, 3476]\n",
      "[0, 0, 0, 3488]\n",
      "[0, 0, 0, 3499]\n",
      "[0, 0, 0, 3510]\n",
      "[0, 0, 0, 3521]\n",
      "[0, 0, 0, 3533]\n",
      "[0, 0, 0, 3545]\n",
      "[0, 0, 0, 3557]\n",
      "[0, 0, 0, 3569]\n",
      "[0, 0, 0, 3580]\n",
      "[0, 0, 0, 3592]\n",
      "[0, 0, 0, 3604]\n",
      "[0, 0, 0, 3616]\n",
      "[0, 0, 0, 3628]\n",
      "[0, 0, 0, 3641]\n",
      "[0, 0, 0, 3653]\n",
      "[0, 0, 0, 3665]\n",
      "[0, 0, 0, 3676]\n",
      "[0, 0, 0, 3687]\n",
      "[0, 0, 0, 3698]\n",
      "[0, 0, 0, 3711]\n",
      "[0, 0, 0, 3724]\n",
      "[0, 0, 0, 3735]\n",
      "[0, 0, 0, 3747]\n",
      "[0, 0, 0, 3759]\n",
      "[0, 0, 0, 3770]\n",
      "[0, 0, 0, 3780]\n",
      "[0, 0, 0, 3790]\n",
      "[0, 0, 0, 3801]\n",
      "[0, 0, 0, 3814]\n",
      "[0, 0, 0, 3827]\n",
      "[0, 0, 0, 3839]\n",
      "[0, 0, 0, 3851]\n",
      "[0, 0, 0, 3863]\n",
      "[0, 0, 0, 3874]\n",
      "[0, 0, 0, 3885]\n",
      "[0, 0, 0, 3896]\n",
      "[0, 0, 0, 3908]\n",
      "[0, 0, 0, 3920]\n",
      "[0, 0, 0, 3932]\n",
      "[0, 0, 0, 3944]\n",
      "[0, 0, 0, 3955]\n",
      "[0, 0, 0, 3966]\n",
      "[0, 0, 0, 3978]\n",
      "[0, 0, 0, 3990]\n",
      "[0, 0, 0, 4002]\n",
      "[0, 0, 0, 4013]\n",
      "[0, 0, 0, 4024]\n",
      "[0, 0, 0, 4035]\n",
      "[0, 0, 0, 4047]\n",
      "[0, 0, 0, 4059]\n",
      "[0, 0, 0, 4071]\n",
      "[0, 0, 0, 4083]\n",
      "[0, 0, 0, 4094]\n",
      "[0, 0, 0, 4105]\n",
      "[0, 0, 0, 4117]\n",
      "[0, 0, 0, 4129]\n",
      "[0, 0, 0, 4141]\n",
      "[0, 0, 0, 4153]\n",
      "[0, 0, 0, 4165]\n",
      "[0, 0, 0, 4177]\n",
      "[0, 0, 0, 4188]\n",
      "[0, 0, 0, 4199]\n",
      "[0, 0, 0, 4211]\n",
      "[0, 0, 0, 4223]\n",
      "[0, 0, 0, 4236]\n",
      "[0, 0, 0, 4248]\n",
      "[0, 0, 0, 4260]\n",
      "[0, 0, 0, 4272]\n",
      "[0, 0, 0, 4284]\n",
      "[0, 0, 0, 4295]\n",
      "[0, 0, 0, 4306]\n",
      "[0, 0, 0, 4317]\n",
      "[0, 0, 0, 4327]\n",
      "[0, 0, 0, 4339]\n",
      "[0, 0, 0, 4351]\n",
      "[0, 0, 0, 4364]\n",
      "[0, 0, 0, 4377]\n",
      "[0, 0, 0, 4390]\n",
      "[0, 0, 0, 4401]\n",
      "[0, 0, 0, 4412]\n",
      "[0, 0, 0, 4424]\n",
      "[0, 0, 0, 4436]\n",
      "[0, 0, 0, 4447]\n",
      "[0, 0, 0, 4459]\n",
      "[0, 0, 0, 4471]\n",
      "[0, 0, 0, 4482]\n",
      "[0, 0, 0, 4493]\n",
      "[0, 0, 0, 4504]\n",
      "[0, 0, 0, 4516]\n",
      "[0, 0, 0, 4527]\n",
      "[0, 0, 0, 4538]\n",
      "[0, 0, 0, 4550]\n",
      "[0, 0, 0, 4562]\n",
      "[0, 0, 0, 4574]\n",
      "[0, 0, 0, 4586]\n",
      "[0, 0, 0, 4597]\n",
      "[0, 0, 0, 4609]\n",
      "[0, 1, 0, 4621]\n",
      "[0, 1, 0, 4633]\n",
      "[0, 1, 0, 4645]\n",
      "[0, 1, 0, 4657]\n",
      "[0, 1, 0, 4669]\n",
      "[0, 1, 0, 4680]\n",
      "[0, 1, 0, 4692]\n",
      "[0, 1, 0, 4704]\n",
      "[0, 1, 0, 4715]\n",
      "[0, 1, 0, 4726]\n",
      "[0, 1, 0, 4738]\n",
      "[0, 1, 0, 4750]\n",
      "[0, 1, 0, 4761]\n",
      "[0, 1, 0, 4772]\n",
      "[0, 1, 0, 4784]\n",
      "[0, 1, 0, 4795]\n",
      "[0, 1, 0, 4806]\n",
      "[0, 1, 0, 4817]\n",
      "[0, 1, 0, 4830]\n",
      "[0, 1, 0, 4842]\n",
      "[0, 1, 0, 4854]\n",
      "[0, 1, 0, 4865]\n",
      "[0, 1, 0, 4877]\n",
      "[0, 1, 0, 4888]\n",
      "[0, 1, 0, 4899]\n",
      "[0, 1, 0, 4910]\n",
      "[0, 1, 0, 4922]\n",
      "[0, 1, 0, 4933]\n",
      "[0, 1, 0, 4944]\n",
      "[0, 1, 0, 4955]\n",
      "[0, 1, 0, 4967]\n",
      "[0, 1, 0, 4979]\n",
      "[0, 1, 0, 4991]\n",
      "[0, 1, 0, 5003]\n",
      "[0, 1, 0, 5015]\n",
      "[0, 1, 0, 5027]\n",
      "[0, 1, 0, 5039]\n",
      "[0, 1, 0, 5051]\n",
      "[0, 1, 0, 5062]\n",
      "[0, 1, 0, 5072]\n",
      "[0, 1, 0, 5083]\n",
      "[0, 1, 0, 5094]\n",
      "[0, 1, 0, 5105]\n",
      "[0, 1, 0, 5116]\n",
      "[0, 1, 0, 5128]\n",
      "[0, 1, 0, 5140]\n",
      "[0, 1, 0, 5151]\n",
      "[0, 1, 0, 5163]\n",
      "[0, 1, 0, 5175]\n",
      "[0, 1, 0, 5187]\n",
      "[0, 1, 0, 5199]\n",
      "[0, 1, 0, 5211]\n",
      "[0, 1, 0, 5223]\n",
      "[0, 1, 0, 5235]\n",
      "[0, 1, 0, 5247]\n",
      "[0, 1, 0, 5259]\n",
      "[0, 1, 0, 5270]\n",
      "[0, 1, 0, 5282]\n",
      "[0, 1, 0, 5294]\n",
      "[0, 1, 0, 5304]\n",
      "[0, 1, 0, 5316]\n",
      "[0, 1, 0, 5328]\n",
      "[0, 1, 0, 5340]\n",
      "[0, 1, 0, 5353]\n",
      "[0, 1, 0, 5364]\n",
      "[0, 1, 0, 5375]\n",
      "[0, 1, 0, 5386]\n",
      "[0, 1, 0, 5397]\n",
      "[0, 1, 0, 5409]\n",
      "[0, 1, 0, 5421]\n",
      "[0, 1, 0, 5433]\n",
      "[0, 1, 0, 5445]\n",
      "[0, 1, 0, 5457]\n",
      "[0, 1, 0, 5469]\n",
      "[0, 1, 0, 5480]\n",
      "[0, 1, 0, 5491]\n",
      "[0, 1, 0, 5503]\n",
      "[0, 1, 0, 5514]\n",
      "[0, 1, 0, 5525]\n",
      "[0, 1, 0, 5536]\n",
      "[0, 1, 0, 5547]\n",
      "[0, 1, 0, 5559]\n",
      "[0, 1, 0, 5571]\n",
      "[0, 1, 0, 5583]\n",
      "[0, 1, 0, 5593]\n",
      "[0, 1, 0, 5604]\n",
      "[0, 1, 0, 5617]\n",
      "[0, 1, 0, 5628]\n",
      "[0, 1, 0, 5640]\n",
      "[0, 1, 0, 5652]\n",
      "[1, 1, 0, 5664]\n",
      "[6, 1, 0, 5676]\n",
      "[15, 1, 0, 5688]\n",
      "[28, 1, 0, 5700]\n",
      "[41, 1, 0, 5712]\n",
      "[59, 1, 0, 5723]\n",
      "[77, 1, 0, 5735]\n",
      "[96, 1, 0, 5748]\n",
      "[116, 1, 0, 5760]\n",
      "[136, 1, 0, 5771]\n",
      "[157, 1, 0, 5783]\n",
      "[176, 1, 0, 5794]\n",
      "[195, 1, 0, 5805]\n",
      "[209, 1, 0, 5817]\n",
      "[223, 1, 0, 5828]\n",
      "[227, 1, 0, 5839]\n",
      "[227, 1, 0, 5850]\n",
      "[227, 1, 0, 5862]\n",
      "[227, 1, 0, 5874]\n",
      "[227, 1, 0, 5886]\n",
      "[227, 1, 0, 5897]\n",
      "[227, 1, 0, 5908]\n",
      "[227, 1, 0, 5920]\n",
      "[227, 1, 0, 5932]\n",
      "[227, 1, 0, 5944]\n",
      "[227, 1, 0, 5955]\n",
      "[227, 1, 0, 5967]\n",
      "[227, 1, 0, 5979]\n",
      "[227, 1, 0, 5991]\n",
      "[227, 1, 0, 6002]\n",
      "[227, 1, 0, 6013]\n",
      "[227, 1, 0, 6025]\n",
      "[227, 1, 0, 6036]\n",
      "[228, 1, 0, 6048]\n",
      "[234, 1, 0, 6060]\n",
      "[245, 1, 0, 6072]\n",
      "[259, 1, 0, 6084]\n",
      "[274, 1, 0, 6095]\n",
      "[289, 1, 0, 6107]\n",
      "[305, 1, 0, 6118]\n",
      "[320, 1, 0, 6129]\n",
      "[335, 1, 0, 6140]\n",
      "[349, 1, 0, 6151]\n",
      "[362, 1, 0, 6163]\n",
      "[375, 1, 0, 6175]\n",
      "[388, 1, 0, 6187]\n",
      "[401, 1, 0, 6198]\n",
      "[412, 1, 0, 6209]\n",
      "[421, 1, 0, 6220]\n",
      "[428, 1, 0, 6232]\n",
      "[430, 1, 0, 6244]\n",
      "[430, 1, 0, 6256]\n",
      "[430, 1, 0, 6268]\n",
      "[430, 1, 0, 6279]\n",
      "[430, 1, 0, 6291]\n",
      "[430, 1, 0, 6303]\n",
      "[430, 1, 0, 6316]\n",
      "[430, 1, 0, 6328]\n",
      "[430, 1, 0, 6339]\n",
      "[430, 1, 0, 6350]\n",
      "[430, 1, 0, 6362]\n",
      "[430, 1, 0, 6373]\n",
      "[430, 1, 0, 6384]\n",
      "[430, 1, 0, 6395]\n",
      "[430, 1, 0, 6406]\n",
      "[430, 1, 0, 6418]\n",
      "[430, 1, 0, 6430]\n",
      "[430, 1, 0, 6442]\n",
      "[435, 1, 0, 6455]\n",
      "[445, 1, 0, 6467]\n",
      "[450, 1, 0, 6478]\n",
      "[455, 1, 0, 6489]\n",
      "[462, 1, 0, 6499]\n",
      "[470, 1, 0, 6510]\n",
      "[480, 1, 0, 6521]\n",
      "[491, 1, 0, 6532]\n",
      "[500, 1, 0, 6544]\n",
      "[509, 1, 0, 6556]\n",
      "[518, 1, 0, 6568]\n",
      "[527, 1, 0, 6579]\n",
      "[539, 1, 0, 6590]\n",
      "[551, 1, 0, 6601]\n",
      "[562, 1, 0, 6613]\n",
      "[572, 1, 0, 6625]\n",
      "[582, 1, 0, 6636]\n",
      "[592, 1, 0, 6647]\n",
      "[600, 1, 0, 6658]\n",
      "[606, 1, 0, 6670]\n",
      "[612, 1, 0, 6683]\n",
      "[614, 1, 0, 6695]\n",
      "[614, 1, 0, 6706]\n",
      "[614, 1, 0, 6718]\n",
      "[614, 1, 0, 6730]\n",
      "[614, 1, 0, 6742]\n",
      "[614, 1, 0, 6754]\n",
      "[614, 1, 0, 6765]\n",
      "[614, 1, 0, 6776]\n",
      "[614, 1, 0, 6788]\n",
      "[614, 1, 0, 6801]\n",
      "[625, 1, 0, 6813]\n",
      "[636, 1, 0, 6825]\n",
      "[649, 1, 0, 6837]\n",
      "[662, 1, 0, 6849]\n",
      "[678, 1, 0, 6861]\n",
      "[694, 1, 0, 6873]\n",
      "[710, 1, 0, 6885]\n",
      "[728, 1, 0, 6897]\n",
      "[744, 1, 0, 6908]\n",
      "[760, 1, 0, 6920]\n",
      "[776, 1, 0, 6932]\n",
      "[790, 1, 0, 6943]\n",
      "[800, 1, 0, 6954]\n",
      "[805, 1, 0, 6965]\n",
      "[805, 1, 0, 6977]\n",
      "[805, 1, 0, 6989]\n",
      "[805, 1, 0, 7000]\n",
      "[806, 1, 0, 7011]\n",
      "[806, 1, 0, 7022]\n",
      "[806, 1, 0, 7034]\n",
      "[806, 1, 0, 7046]\n",
      "[806, 1, 0, 7057]\n",
      "[806, 1, 0, 7069]\n",
      "[806, 1, 0, 7081]\n",
      "[806, 1, 0, 7093]\n",
      "[806, 1, 0, 7104]\n",
      "[806, 1, 0, 7116]\n",
      "[806, 1, 0, 7128]\n",
      "[806, 1, 0, 7140]\n",
      "[806, 1, 0, 7152]\n",
      "[806, 1, 0, 7164]\n",
      "[806, 1, 0, 7175]\n",
      "[806, 1, 0, 7186]\n",
      "[806, 1, 0, 7197]\n",
      "[806, 1, 0, 7208]\n",
      "[806, 1, 0, 7219]\n",
      "[806, 1, 0, 7230]\n",
      "[806, 1, 0, 7241]\n",
      "[806, 1, 0, 7252]\n",
      "[806, 1, 0, 7263]\n",
      "[806, 1, 0, 7275]\n",
      "[806, 1, 0, 7288]\n",
      "[806, 1, 0, 7300]\n",
      "[806, 1, 0, 7311]\n",
      "[806, 1, 0, 7322]\n",
      "[806, 1, 0, 7333]\n",
      "[806, 1, 0, 7344]\n",
      "[806, 1, 0, 7355]\n",
      "[806, 1, 0, 7367]\n",
      "[806, 1, 0, 7379]\n",
      "[808, 1, 0, 7391]\n",
      "[810, 1, 0, 7403]\n",
      "[817, 1, 0, 7415]\n",
      "[822, 1, 0, 7427]\n",
      "[827, 1, 0, 7438]\n",
      "[833, 1, 0, 7449]\n",
      "[839, 1, 0, 7460]\n",
      "[846, 1, 0, 7471]\n",
      "[853, 1, 0, 7482]\n",
      "[858, 1, 0, 7494]\n",
      "[863, 1, 0, 7507]\n",
      "[867, 1, 0, 7519]\n",
      "[869, 1, 0, 7530]\n",
      "[869, 1, 0, 7542]\n",
      "[869, 1, 0, 7554]\n",
      "[869, 1, 0, 7566]\n",
      "[869, 1, 0, 7577]\n",
      "[869, 1, 0, 7588]\n",
      "[869, 1, 0, 7600]\n",
      "[869, 1, 0, 7612]\n",
      "[869, 1, 0, 7624]\n",
      "[869, 1, 0, 7635]\n",
      "[869, 1, 0, 7646]\n",
      "[869, 1, 0, 7658]\n",
      "[869, 1, 0, 7670]\n",
      "[869, 1, 0, 7681]\n",
      "[869, 1, 0, 7692]\n",
      "[869, 1, 0, 7704]\n",
      "[869, 1, 0, 7715]\n",
      "[869, 1, 0, 7727]\n",
      "[869, 1, 0, 7739]\n",
      "[869, 1, 0, 7751]\n",
      "[869, 1, 0, 7762]\n",
      "[869, 1, 0, 7773]\n",
      "[869, 1, 0, 7784]\n",
      "[869, 1, 0, 7796]\n",
      "[869, 1, 0, 7808]\n",
      "[869, 1, 0, 7820]\n",
      "[869, 1, 0, 7832]\n",
      "[869, 1, 0, 7844]\n",
      "[869, 1, 0, 7856]\n",
      "[869, 1, 0, 7868]\n",
      "[869, 1, 0, 7880]\n",
      "[869, 1, 0, 7892]\n",
      "[869, 1, 0, 7904]\n",
      "[869, 1, 0, 7916]\n",
      "[869, 1, 0, 7928]\n",
      "[869, 1, 0, 7939]\n",
      "[869, 1, 0, 7950]\n",
      "[869, 1, 0, 7962]\n",
      "[869, 1, 0, 7974]\n",
      "[869, 1, 0, 7986]\n",
      "[870, 1, 0, 7998]\n",
      "[870, 1, 0, 8010]\n",
      "[872, 1, 0, 8022]\n",
      "[877, 1, 0, 8034]\n",
      "[885, 1, 0, 8046]\n",
      "[895, 1, 0, 8057]\n",
      "[907, 1, 0, 8069]\n",
      "[920, 1, 0, 8080]\n",
      "[937, 1, 0, 8091]\n",
      "[954, 1, 0, 8102]\n",
      "[972, 1, 0, 8113]\n",
      "[992, 1, 0, 8125]\n",
      "[1009, 1, 0, 8136]\n",
      "[1023, 1, 0, 8148]\n",
      "[1036, 1, 0, 8160]\n",
      "[1052, 1, 0, 8172]\n",
      "[1067, 1, 0, 8184]\n",
      "[1084, 1, 0, 8196]\n",
      "[1098, 1, 0, 8208]\n",
      "[1112, 1, 0, 8220]\n",
      "[1124, 1, 0, 8233]\n",
      "[1140, 1, 0, 8245]\n",
      "[1160, 1, 1, 8257]\n",
      "[1180, 1, 1, 8268]\n",
      "[1195, 1, 1, 8280]\n",
      "[1201, 1, 1, 8292]\n",
      "[1205, 1, 1, 8304]\n",
      "[1208, 1, 1, 8316]\n",
      "[1211, 1, 1, 8328]\n",
      "[1211, 1, 1, 8340]\n",
      "[1211, 1, 1, 8352]\n",
      "[1212, 1, 1, 8364]\n",
      "[1212, 1, 1, 8375]\n",
      "[1212, 1, 1, 8385]\n",
      "[1212, 1, 1, 8398]\n",
      "[1212, 1, 1, 8409]\n",
      "[1212, 1, 1, 8420]\n",
      "[1212, 1, 1, 8432]\n",
      "[1212, 1, 1, 8444]\n",
      "[1212, 1, 1, 8455]\n",
      "[1212, 1, 1, 8467]\n",
      "[1212, 1, 1, 8479]\n",
      "[1212, 1, 1, 8491]\n",
      "[1212, 1, 1, 8503]\n",
      "[1212, 1, 1, 8515]\n",
      "[1212, 1, 1, 8528]\n",
      "[1213, 1, 1, 8540]\n",
      "[1213, 1, 1, 8552]\n",
      "[1213, 1, 1, 8564]\n",
      "[1213, 1, 1, 8575]\n",
      "[1213, 1, 1, 8586]\n",
      "[1213, 1, 1, 8598]\n",
      "[1213, 1, 1, 8611]\n",
      "[1213, 1, 1, 8623]\n",
      "[1213, 1, 1, 8635]\n",
      "[1213, 1, 1, 8648]\n",
      "[1213, 1, 1, 8660]\n",
      "[1213, 1, 1, 8672]\n",
      "[1213, 1, 1, 8683]\n",
      "[1213, 1, 1, 8694]\n",
      "[1213, 1, 1, 8705]\n",
      "[1213, 1, 1, 8716]\n",
      "[1213, 1, 1, 8728]\n",
      "[1216, 1, 1, 8739]\n",
      "[1217, 1, 1, 8750]\n",
      "[1217, 1, 1, 8762]\n",
      "[1217, 1, 1, 8773]\n",
      "[1217, 1, 1, 8785]\n",
      "[1217, 1, 1, 8797]\n",
      "[1217, 1, 1, 8809]\n",
      "[1217, 1, 1, 8820]\n",
      "[1217, 1, 1, 8831]\n",
      "[1217, 1, 1, 8843]\n",
      "[1217, 1, 1, 8855]\n",
      "[1217, 1, 1, 8867]\n",
      "[1217, 1, 1, 8879]\n",
      "[1217, 1, 1, 8891]\n",
      "[1217, 1, 1, 8903]\n",
      "[1217, 1, 1, 8915]\n",
      "[1217, 1, 1, 8927]\n",
      "[1217, 1, 1, 8939]\n",
      "[1217, 1, 1, 8951]\n",
      "[1217, 1, 1, 8963]\n",
      "[1217, 1, 1, 8975]\n",
      "[1217, 1, 1, 8987]\n",
      "[1217, 1, 1, 8999]\n",
      "[1217, 1, 1, 9011]\n",
      "[1217, 1, 1, 9023]\n",
      "[1217, 1, 1, 9034]\n",
      "[1217, 1, 1, 9045]\n",
      "[1217, 1, 1, 9057]\n",
      "[1217, 1, 1, 9069]\n",
      "[1217, 1, 1, 9081]\n",
      "[1217, 1, 1, 9093]\n",
      "[1217, 1, 1, 9104]\n",
      "[1217, 1, 1, 9115]\n",
      "[1217, 1, 1, 9126]\n",
      "[1217, 1, 1, 9138]\n",
      "[1217, 1, 1, 9149]\n",
      "[1217, 1, 1, 9160]\n",
      "[1217, 1, 1, 9171]\n",
      "[1217, 1, 1, 9183]\n",
      "[1217, 1, 1, 9195]\n",
      "[1217, 1, 1, 9206]\n",
      "[1218, 1, 1, 9217]\n",
      "[1221, 1, 1, 9228]\n",
      "[1224, 1, 1, 9239]\n",
      "[1228, 1, 1, 9251]\n",
      "[1231, 1, 1, 9263]\n",
      "[1234, 1, 1, 9274]\n",
      "[1237, 1, 1, 9285]\n",
      "[1239, 1, 1, 9297]\n",
      "[1239, 1, 1, 9309]\n",
      "[1239, 1, 1, 9321]\n",
      "[1239, 1, 1, 9334]\n",
      "[1240, 1, 1, 9346]\n",
      "[1241, 1, 1, 9357]\n",
      "[1241, 1, 1, 9369]\n",
      "[1241, 1, 1, 9380]\n",
      "[1241, 1, 1, 9391]\n",
      "[1241, 1, 1, 9402]\n",
      "[1241, 1, 1, 9414]\n",
      "[1241, 1, 1, 9426]\n",
      "[1241, 1, 1, 9438]\n",
      "[1241, 1, 1, 9450]\n",
      "[1241, 1, 1, 9462]\n",
      "[1241, 1, 1, 9473]\n",
      "[1241, 1, 1, 9484]\n",
      "[1241, 1, 1, 9496]\n",
      "[1241, 1, 1, 9508]\n",
      "[1241, 1, 1, 9519]\n",
      "[1241, 1, 1, 9530]\n",
      "[1241, 1, 1, 9542]\n",
      "[1241, 1, 1, 9554]\n",
      "[1241, 1, 1, 9566]\n",
      "[1241, 1, 1, 9578]\n",
      "[1241, 1, 1, 9590]\n",
      "[1241, 1, 1, 9602]\n",
      "[1241, 1, 1, 9614]\n",
      "[1241, 1, 1, 9625]\n",
      "[1241, 1, 1, 9636]\n",
      "[1241, 1, 1, 9647]\n",
      "[1241, 1, 1, 9659]\n",
      "[1241, 1, 1, 9671]\n",
      "[1241, 1, 1, 9683]\n",
      "[1241, 1, 1, 9695]\n",
      "[1241, 1, 1, 9707]\n",
      "[1241, 1, 1, 9718]\n",
      "[1242, 1, 1, 9729]\n",
      "[1243, 1, 1, 9741]\n",
      "[1243, 1, 1, 9753]\n",
      "[1243, 1, 1, 9764]\n",
      "[1243, 1, 1, 9776]\n",
      "[1243, 1, 1, 9789]\n",
      "[1244, 1, 1, 9801]\n",
      "[1244, 1, 1, 9813]\n",
      "[1244, 1, 1, 9825]\n",
      "[1244, 1, 1, 9837]\n",
      "[1244, 1, 1, 9848]\n",
      "[1244, 1, 1, 9859]\n",
      "[1244, 1, 1, 9871]\n",
      "[1244, 1, 1, 9883]\n",
      "[1244, 1, 1, 9894]\n",
      "[1244, 1, 1, 9905]\n",
      "[1244, 1, 1, 9917]\n",
      "[1244, 1, 1, 9929]\n",
      "[1244, 1, 1, 9942]\n",
      "[1244, 1, 1, 9955]\n",
      "[1244, 1, 1, 9968]\n",
      "[1244, 1, 1, 9980]\n",
      "[1244, 1, 1, 9991]\n",
      "[1244, 1, 1, 10002]\n",
      "[1244, 1, 1, 10014]\n",
      "[1244, 1, 1, 10026]\n",
      "[1244, 1, 1, 10038]\n",
      "[1244, 1, 1, 10050]\n",
      "[1244, 1, 1, 10062]\n",
      "[1244, 1, 1, 10074]\n",
      "[1244, 1, 1, 10085]\n",
      "[1244, 1, 1, 10097]\n",
      "[1244, 1, 1, 10108]\n",
      "[1244, 1, 1, 10119]\n",
      "[1244, 1, 1, 10130]\n",
      "[1244, 1, 1, 10141]\n",
      "[1244, 1, 1, 10153]\n",
      "[1244, 1, 1, 10165]\n",
      "[1244, 1, 1, 10177]\n",
      "[1244, 1, 1, 10188]\n",
      "[1253, 1, 1, 10200]\n",
      "[1272, 1, 1, 10211]\n",
      "[1294, 1, 1, 10222]\n",
      "[1319, 1, 1, 10234]\n",
      "[1342, 1, 1, 10247]\n",
      "[1363, 1, 1, 10260]\n",
      "[1382, 1, 1, 10272]\n",
      "[1400, 1, 1, 10284]\n",
      "[1418, 1, 1, 10295]\n",
      "[1431, 1, 1, 10307]\n",
      "[1444, 1, 1, 10319]\n",
      "[1454, 1, 1, 10331]\n",
      "[1465, 1, 1, 10343]\n",
      "[1477, 1, 1, 10354]\n",
      "[1491, 1, 1, 10365]\n",
      "[1508, 1, 1, 10376]\n",
      "[1525, 1, 1, 10388]\n",
      "[1544, 1, 1, 10399]\n",
      "[1563, 1, 1, 10410]\n",
      "[1586, 1, 1, 10422]\n",
      "[1612, 1, 1, 10433]\n",
      "[1636, 1, 1, 10445]\n",
      "[1656, 1, 1, 10457]\n",
      "[1673, 1, 1, 10468]\n",
      "[1686, 1, 1, 10479]\n",
      "[1695, 1, 1, 10490]\n",
      "[1697, 1, 1, 10501]\n",
      "[1701, 1, 1, 10512]\n",
      "[1706, 1, 1, 10524]\n",
      "[1711, 1, 1, 10535]\n",
      "[1713, 1, 1, 10546]\n",
      "[1713, 1, 1, 10558]\n",
      "[1713, 1, 1, 10569]\n",
      "[1713, 1, 1, 10580]\n",
      "[1716, 1, 1, 10591]\n",
      "[1719, 1, 1, 10602]\n",
      "[1719, 1, 1, 10614]\n",
      "[1719, 1, 1, 10625]\n",
      "[1719, 1, 1, 10636]\n",
      "[1719, 1, 1, 10648]\n",
      "[1719, 1, 1, 10660]\n",
      "[1719, 1, 1, 10672]\n",
      "[1719, 1, 1, 10683]\n",
      "[1719, 1, 1, 10695]\n",
      "[1719, 1, 1, 10707]\n",
      "[1719, 1, 1, 10719]\n",
      "[1719, 1, 1, 10730]\n",
      "[1719, 1, 1, 10742]\n",
      "[1719, 1, 1, 10754]\n",
      "[1719, 1, 1, 10766]\n",
      "[1719, 1, 1, 10778]\n",
      "[1719, 1, 1, 10790]\n",
      "[1719, 1, 1, 10802]\n",
      "[1719, 1, 1, 10814]\n",
      "[1719, 1, 1, 10825]\n",
      "[1719, 1, 1, 10836]\n",
      "[1719, 1, 1, 10848]\n",
      "[1719, 1, 1, 10859]\n",
      "[1719, 1, 1, 10871]\n",
      "[1719, 1, 1, 10883]\n",
      "[1719, 1, 1, 10895]\n",
      "[1719, 1, 1, 10907]\n",
      "[1719, 1, 1, 10919]\n",
      "[1719, 1, 1, 10930]\n",
      "[1719, 1, 1, 10941]\n",
      "[1719, 1, 1, 10953]\n",
      "[1719, 1, 1, 10965]\n",
      "[1719, 1, 1, 10977]\n",
      "[1719, 1, 1, 10988]\n",
      "[1719, 1, 1, 10999]\n",
      "[1719, 1, 1, 11011]\n",
      "[1719, 1, 1, 11023]\n",
      "[1719, 1, 1, 11035]\n",
      "[1719, 1, 1, 11047]\n",
      "[1719, 1, 1, 11058]\n",
      "[1719, 1, 1, 11069]\n",
      "[1719, 1, 1, 11080]\n",
      "[1719, 1, 1, 11091]\n",
      "[1719, 1, 1, 11103]\n",
      "[1719, 1, 1, 11116]\n",
      "[1719, 1, 1, 11128]\n",
      "[1719, 1, 1, 11140]\n",
      "[1719, 1, 1, 11152]\n",
      "[1719, 1, 1, 11163]\n",
      "[1719, 1, 1, 11174]\n",
      "[1719, 1, 1, 11185]\n",
      "[1719, 1, 1, 11196]\n",
      "[1724, 1, 1, 11207]\n",
      "[1738, 1, 1, 11220]\n",
      "[1755, 1, 1, 11232]\n",
      "[1772, 1, 1, 11244]\n",
      "[1789, 1, 1, 11256]\n",
      "[1805, 1, 1, 11267]\n",
      "[1820, 1, 1, 11278]\n",
      "[1835, 1, 1, 11289]\n",
      "[1850, 1, 1, 11300]\n",
      "[1865, 1, 1, 11311]\n",
      "[1880, 1, 1, 11323]\n",
      "[1899, 1, 1, 11335]\n",
      "[1920, 1, 1, 11347]\n",
      "[1943, 1, 1, 11359]\n",
      "[1967, 1, 1, 11371]\n",
      "[1990, 1, 1, 11382]\n",
      "[2013, 1, 1, 11393]\n",
      "[2033, 1, 1, 11405]\n",
      "[2054, 1, 1, 11417]\n",
      "[2072, 1, 1, 11430]\n",
      "[2088, 1, 1, 11442]\n",
      "[2101, 1, 1, 11453]\n",
      "[2110, 1, 1, 11464]\n",
      "[2116, 1, 1, 11476]\n",
      "[2118, 1, 1, 11488]\n",
      "[2121, 1, 1, 11500]\n",
      "[2124, 1, 1, 11511]\n",
      "[2136, 1, 1, 11522]\n",
      "[2151, 1, 1, 11533]\n",
      "[2167, 1, 1, 11545]\n",
      "[2183, 1, 1, 11557]\n",
      "[2201, 1, 1, 11568]\n",
      "[2219, 1, 1, 11579]\n",
      "[2237, 1, 1, 11591]\n",
      "[2251, 1, 1, 11602]\n",
      "[2268, 1, 1, 11614]\n",
      "[2286, 1, 1, 11626]\n",
      "[2307, 1, 1, 11637]\n",
      "[2330, 1, 1, 11648]\n",
      "[2350, 1, 1, 11660]\n",
      "[2368, 1, 1, 11671]\n",
      "[2382, 1, 1, 11683]\n",
      "[2394, 1, 1, 11695]\n",
      "[2406, 1, 1, 11707]\n",
      "[2415, 1, 1, 11719]\n",
      "[2420, 1, 1, 11731]\n",
      "[2425, 1, 1, 11742]\n",
      "[2432, 1, 1, 11753]\n",
      "[2436, 1, 1, 11765]\n",
      "[2440, 1, 1, 11777]\n",
      "[2443, 1, 1, 11789]\n",
      "[2446, 1, 1, 11800]\n",
      "[2448, 1, 1, 11812]\n",
      "[2448, 1, 1, 11824]\n",
      "[2448, 1, 1, 11836]\n",
      "[2448, 1, 1, 11848]\n",
      "[2448, 1, 1, 11859]\n",
      "[2448, 1, 1, 11870]\n",
      "[2448, 1, 1, 11882]\n",
      "[2448, 1, 1, 11893]\n",
      "[2448, 1, 1, 11904]\n",
      "[2448, 1, 1, 11916]\n",
      "[2448, 1, 1, 11929]\n",
      "[2448, 1, 1, 11942]\n",
      "[2448, 1, 1, 11955]\n",
      "[2448, 1, 1, 11966]\n",
      "[2448, 1, 1, 11978]\n",
      "[2448, 1, 1, 11989]\n",
      "[2448, 1, 1, 12000]\n",
      "[2448, 1, 1, 12011]\n",
      "[2448, 1, 1, 12024]\n",
      "[2448, 1, 1, 12035]\n",
      "[2448, 1, 1, 12046]\n",
      "[2448, 1, 1, 12058]\n",
      "[2448, 1, 1, 12070]\n",
      "[2448, 1, 1, 12081]\n",
      "[2448, 1, 1, 12092]\n",
      "[2448, 1, 1, 12104]\n",
      "[2448, 1, 1, 12116]\n",
      "[2448, 1, 1, 12128]\n",
      "[2448, 1, 1, 12140]\n",
      "[2448, 1, 1, 12151]\n",
      "[2448, 1, 1, 12162]\n",
      "[2448, 1, 1, 12173]\n",
      "[2448, 1, 1, 12185]\n",
      "[2449, 1, 1, 12197]\n",
      "[2458, 1, 1, 12209]\n",
      "[2472, 1, 1, 12222]\n",
      "[2486, 1, 1, 12234]\n",
      "[2504, 1, 1, 12245]\n",
      "[2522, 1, 1, 12256]\n",
      "[2539, 1, 1, 12268]\n",
      "[2552, 1, 1, 12280]\n",
      "[2565, 1, 1, 12291]\n",
      "[2578, 1, 1, 12303]\n",
      "[2591, 1, 1, 12315]\n",
      "[2605, 1, 1, 12326]\n",
      "[2623, 1, 1, 12338]\n",
      "[2644, 1, 1, 12349]\n",
      "[2665, 1, 1, 12361]\n",
      "[2690, 1, 1, 12373]\n",
      "[2715, 1, 1, 12385]\n",
      "[2735, 1, 1, 12397]\n",
      "[2750, 1, 1, 12410]\n",
      "[2765, 1, 1, 12422]\n",
      "[2779, 1, 1, 12433]\n",
      "[2788, 1, 1, 12444]\n",
      "[2796, 1, 1, 12456]\n",
      "[2801, 1, 1, 12469]\n",
      "[2806, 1, 1, 12480]\n",
      "[2811, 1, 1, 12491]\n",
      "[2813, 1, 1, 12502]\n",
      "[2813, 1, 1, 12514]\n",
      "[2813, 1, 1, 12525]\n",
      "[2813, 1, 1, 12537]\n",
      "[2813, 1, 1, 12549]\n",
      "[2813, 1, 1, 12562]\n",
      "[2813, 1, 1, 12575]\n",
      "[2813, 1, 1, 12588]\n",
      "[2813, 1, 1, 12599]\n",
      "[2813, 1, 1, 12610]\n",
      "[2813, 1, 1, 12622]\n",
      "[2813, 1, 1, 12634]\n",
      "[2813, 1, 1, 12646]\n",
      "[2813, 1, 1, 12657]\n",
      "[2813, 1, 1, 12669]\n",
      "[2813, 1, 1, 12681]\n",
      "[2813, 1, 1, 12692]\n",
      "[2813, 1, 1, 12703]\n",
      "[2813, 1, 1, 12713]\n",
      "[2813, 1, 1, 12724]\n",
      "[2813, 1, 1, 12736]\n",
      "[2813, 1, 1, 12747]\n",
      "[2813, 1, 1, 12758]\n",
      "[2813, 1, 1, 12770]\n",
      "[2813, 1, 1, 12782]\n",
      "[2813, 1, 1, 12794]\n",
      "[2813, 1, 1, 12806]\n",
      "[2813, 1, 1, 12819]\n",
      "[2813, 1, 1, 12831]\n",
      "[2813, 1, 1, 12842]\n",
      "[2813, 1, 1, 12853]\n",
      "[2813, 1, 1, 12864]\n",
      "[2813, 1, 1, 12875]\n",
      "[2813, 1, 1, 12887]\n",
      "[2813, 1, 1, 12899]\n",
      "[2813, 1, 1, 12911]\n",
      "[2813, 1, 1, 12923]\n",
      "[2813, 1, 1, 12935]\n",
      "[2813, 1, 1, 12947]\n",
      "[2813, 1, 1, 12959]\n",
      "[2813, 1, 1, 12971]\n",
      "[2813, 1, 1, 12982]\n",
      "[2815, 1, 1, 12993]\n",
      "[2817, 1, 1, 13005]\n",
      "[2818, 1, 1, 13018]\n",
      "[2818, 1, 1, 13030]\n",
      "[2818, 1, 1, 13041]\n",
      "[2818, 1, 1, 13052]\n",
      "[2818, 1, 1, 13063]\n",
      "[2818, 1, 1, 13074]\n",
      "[2818, 1, 1, 13086]\n",
      "[2818, 1, 1, 13098]\n",
      "[2818, 1, 1, 13110]\n",
      "[2818, 1, 1, 13122]\n",
      "[2818, 1, 1, 13135]\n",
      "[2818, 1, 1, 13147]\n",
      "[2818, 1, 1, 13158]\n",
      "[2818, 1, 1, 13170]\n",
      "[2818, 1, 1, 13182]\n",
      "[2818, 1, 1, 13194]\n",
      "[2818, 1, 1, 13206]\n",
      "[2818, 1, 1, 13217]\n",
      "[2818, 1, 1, 13229]\n",
      "[2818, 1, 1, 13240]\n",
      "[2818, 1, 1, 13250]\n",
      "[2818, 1, 1, 13262]\n",
      "[2818, 1, 1, 13275]\n",
      "[2818, 1, 1, 13288]\n",
      "[2818, 1, 1, 13301]\n",
      "[2818, 1, 1, 13313]\n",
      "[2818, 1, 1, 13325]\n",
      "[2818, 1, 1, 13337]\n",
      "[2818, 1, 1, 13348]\n",
      "[2818, 1, 1, 13358]\n",
      "[2818, 1, 1, 13369]\n",
      "[2818, 1, 1, 13381]\n",
      "[2818, 1, 1, 13393]\n",
      "[2818, 1, 1, 13405]\n",
      "[2818, 1, 1, 13417]\n",
      "[2818, 1, 1, 13428]\n",
      "[2818, 1, 1, 13439]\n",
      "[2818, 1, 1, 13451]\n",
      "[2818, 1, 1, 13464]\n",
      "[2818, 1, 1, 13477]\n",
      "[2818, 1, 1, 13489]\n",
      "[2818, 1, 1, 13501]\n",
      "[2818, 1, 1, 13513]\n",
      "[2818, 1, 1, 13525]\n",
      "[2818, 1, 1, 13536]\n",
      "[2818, 1, 1, 13547]\n",
      "[2818, 1, 1, 13558]\n",
      "[2818, 1, 1, 13569]\n",
      "[2818, 1, 1, 13580]\n",
      "[2818, 1, 1, 13592]\n",
      "[2818, 1, 1, 13604]\n",
      "[2818, 1, 1, 13616]\n",
      "[2819, 1, 1, 13628]\n",
      "[2824, 1, 1, 13639]\n",
      "[2826, 1, 1, 13651]\n",
      "[2826, 1, 1, 13663]\n",
      "[2826, 1, 1, 13675]\n",
      "[2826, 1, 1, 13687]\n",
      "[2826, 1, 1, 13698]\n",
      "[2826, 1, 1, 13710]\n",
      "[2826, 1, 1, 13721]\n",
      "[2826, 1, 1, 13733]\n",
      "[2826, 1, 1, 13744]\n",
      "[2826, 1, 1, 13756]\n",
      "[2826, 1, 1, 13768]\n",
      "[2826, 1, 1, 13779]\n",
      "[2826, 1, 1, 13790]\n",
      "[2826, 1, 1, 13801]\n",
      "[2826, 1, 1, 13813]\n",
      "[2826, 1, 1, 13826]\n",
      "[2826, 1, 1, 13839]\n",
      "[2826, 1, 1, 13851]\n",
      "[2826, 1, 1, 13862]\n",
      "[2826, 1, 1, 13873]\n",
      "[2826, 1, 1, 13884]\n",
      "[2826, 1, 1, 13896]\n",
      "[2826, 1, 1, 13908]\n",
      "[2826, 1, 1, 13920]\n",
      "[2826, 1, 1, 13932]\n",
      "[2826, 1, 1, 13943]\n",
      "[2826, 1, 1, 13954]\n",
      "[2826, 1, 1, 13966]\n",
      "[2826, 1, 1, 13977]\n",
      "[2826, 1, 1, 13989]\n",
      "[2826, 1, 1, 14001]\n",
      "[2826, 1, 1, 14013]\n",
      "[2826, 1, 1, 14026]\n",
      "[2826, 1, 1, 14038]\n",
      "[2826, 1, 1, 14050]\n",
      "[2826, 1, 1, 14062]\n",
      "[2826, 1, 1, 14073]\n",
      "[2826, 1, 1, 14084]\n",
      "[2826, 1, 1, 14096]\n",
      "[2826, 1, 1, 14107]\n",
      "[2826, 1, 1, 14119]\n",
      "[2826, 1, 1, 14131]\n",
      "[2826, 1, 1, 14142]\n",
      "[2826, 1, 1, 14152]\n",
      "[2826, 1, 1, 14163]\n",
      "[2826, 1, 1, 14175]\n",
      "[2826, 1, 1, 14187]\n",
      "[2826, 1, 1, 14200]\n",
      "[2826, 1, 1, 14213]\n",
      "[2826, 1, 1, 14225]\n",
      "[2826, 1, 1, 14237]\n",
      "[2826, 1, 1, 14249]\n",
      "[2826, 1, 1, 14261]\n",
      "[2826, 1, 1, 14272]\n",
      "[2826, 1, 1, 14284]\n",
      "[2826, 1, 1, 14296]\n",
      "[2826, 1, 1, 14307]\n",
      "[2826, 1, 1, 14318]\n",
      "[2826, 1, 1, 14329]\n",
      "[2826, 1, 1, 14342]\n",
      "[2826, 1, 1, 14354]\n",
      "[2826, 1, 1, 14365]\n",
      "[2826, 1, 1, 14377]\n",
      "[2826, 1, 1, 14389]\n",
      "[2826, 1, 1, 14401]\n",
      "[2826, 1, 1, 14413]\n",
      "[2826, 1, 1, 14425]\n",
      "[2826, 1, 1, 14436]\n",
      "[2826, 1, 1, 14447]\n",
      "[2826, 1, 1, 14458]\n",
      "[2826, 1, 1, 14470]\n",
      "[2826, 1, 1, 14481]\n",
      "[2826, 1, 1, 14493]\n",
      "[2826, 1, 1, 14504]\n",
      "[2826, 1, 1, 14514]\n",
      "[2826, 1, 1, 14525]\n",
      "[2826, 1, 1, 14537]\n",
      "[2826, 1, 1, 14549]\n",
      "[2826, 1, 1, 14561]\n",
      "[2826, 1, 1, 14573]\n",
      "[2826, 1, 1, 14585]\n",
      "[2826, 1, 1, 14596]\n",
      "[2826, 1, 1, 14608]\n",
      "[2826, 1, 1, 14620]\n",
      "[2826, 1, 1, 14631]\n",
      "[2826, 1, 1, 14642]\n",
      "[2826, 1, 1, 14652]\n",
      "[2826, 1, 1, 14662]\n",
      "[2826, 1, 1, 14673]\n",
      "[2826, 1, 1, 14684]\n",
      "[2826, 1, 1, 14696]\n",
      "[2826, 1, 1, 14708]\n",
      "[2826, 1, 1, 14720]\n",
      "[2826, 1, 1, 14732]\n",
      "[2826, 1, 1, 14744]\n",
      "[2826, 1, 1, 14755]\n",
      "[2826, 1, 1, 14766]\n",
      "[2826, 1, 1, 14777]\n",
      "[2826, 1, 1, 14787]\n",
      "[2826, 1, 1, 14798]\n",
      "[2826, 1, 1, 14809]\n",
      "[2826, 1, 1, 14821]\n",
      "[2826, 1, 1, 14833]\n",
      "[2826, 1, 1, 14846]\n",
      "[2826, 1, 1, 14857]\n",
      "[2826, 1, 1, 14869]\n",
      "[2826, 1, 1, 14881]\n",
      "[2826, 1, 1, 14893]\n",
      "[2826, 1, 1, 14905]\n",
      "[2826, 1, 1, 14917]\n",
      "[2826, 1, 1, 14928]\n",
      "[2826, 1, 1, 14939]\n",
      "[2826, 1, 1, 14950]\n",
      "[2826, 1, 1, 14961]\n",
      "[2826, 1, 1, 14971]\n",
      "[2826, 1, 1, 14982]\n",
      "[2826, 1, 1, 14994]\n",
      "[2826, 1, 1, 15006]\n",
      "[2826, 1, 1, 15018]\n",
      "[2826, 1, 1, 15030]\n",
      "[2826, 1, 1, 15042]\n",
      "[2826, 1, 1, 15055]\n",
      "[2826, 1, 1, 15066]\n",
      "[2826, 1, 1, 15078]\n",
      "[2826, 1, 1, 15090]\n",
      "[2826, 1, 1, 15102]\n",
      "[2826, 1, 1, 15114]\n",
      "[2826, 1, 1, 15126]\n",
      "[2826, 1, 1, 15138]\n",
      "[2826, 1, 1, 15150]\n",
      "[2826, 1, 1, 15161]\n",
      "[2826, 1, 1, 15172]\n",
      "[2826, 1, 1, 15184]\n",
      "[2826, 1, 1, 15196]\n",
      "[2826, 1, 1, 15208]\n",
      "[2826, 1, 1, 15220]\n",
      "[2826, 1, 1, 15231]\n",
      "[2826, 1, 1, 15242]\n",
      "[2826, 1, 1, 15254]\n",
      "[2826, 1, 1, 15265]\n",
      "[2826, 1, 1, 15277]\n",
      "[2826, 1, 1, 15289]\n",
      "[2826, 1, 1, 15301]\n",
      "[2826, 1, 1, 15313]\n",
      "[2826, 1, 1, 15325]\n",
      "[2826, 1, 1, 15337]\n",
      "[2826, 1, 1, 15349]\n",
      "[2826, 1, 1, 15360]\n",
      "[2826, 1, 1, 15370]\n",
      "[2826, 1, 1, 15381]\n",
      "[2826, 1, 1, 15392]\n",
      "[2826, 1, 1, 15405]\n",
      "[2826, 1, 1, 15418]\n",
      "[2826, 1, 1, 15430]\n",
      "[2826, 1, 1, 15442]\n",
      "[2826, 1, 1, 15454]\n",
      "[2826, 1, 1, 15466]\n",
      "[2826, 1, 1, 15478]\n",
      "[2826, 1, 1, 15489]\n",
      "[2826, 1, 1, 15501]\n",
      "[2826, 1, 1, 15513]\n",
      "[2826, 1, 1, 15525]\n",
      "[2826, 1, 1, 15537]\n",
      "[2826, 1, 1, 15548]\n",
      "[2826, 1, 1, 15560]\n",
      "[2826, 1, 1, 15571]\n",
      "[2826, 1, 1, 15583]\n",
      "[2826, 1, 1, 15595]\n",
      "[2826, 1, 1, 15606]\n",
      "[2826, 1, 1, 15617]\n",
      "[2826, 1, 1, 15629]\n",
      "[2826, 1, 1, 15641]\n",
      "[2826, 1, 1, 15653]\n",
      "[2826, 1, 1, 15665]\n",
      "[2826, 1, 1, 15677]\n",
      "[2826, 1, 1, 15689]\n",
      "[2826, 1, 1, 15700]\n",
      "[2826, 1, 1, 15711]\n",
      "[2826, 1, 1, 15722]\n",
      "[2826, 1, 1, 15734]\n",
      "[2826, 1, 1, 15746]\n",
      "[2826, 1, 1, 15759]\n",
      "[2826, 1, 1, 15772]\n",
      "[2826, 1, 1, 15784]\n",
      "[2826, 1, 1, 15796]\n",
      "[2826, 1, 1, 15808]\n",
      "[2826, 1, 1, 15819]\n",
      "[2826, 1, 1, 15831]\n",
      "[2826, 1, 1, 15843]\n",
      "[2826, 1, 1, 15856]\n",
      "[2826, 1, 1, 15868]\n",
      "[2826, 1, 1, 15879]\n",
      "[2826, 1, 1, 15891]\n",
      "[2826, 1, 1, 15903]\n",
      "[2826, 1, 1, 15915]\n",
      "[2826, 1, 1, 15926]\n",
      "[2826, 1, 1, 15937]\n",
      "[2826, 1, 1, 15949]\n",
      "[2826, 1, 1, 15962]\n",
      "[2826, 1, 1, 15974]\n",
      "[2826, 1, 1, 15985]\n",
      "[2826, 1, 1, 15997]\n",
      "[2826, 1, 1, 16009]\n",
      "[2826, 1, 1, 16021]\n",
      "[2826, 1, 1, 16032]\n",
      "[2826, 1, 1, 16043]\n",
      "[2826, 1, 1, 16054]\n",
      "[2826, 1, 1, 16066]\n",
      "[2826, 1, 1, 16077]\n",
      "[2826, 1, 1, 16088]\n",
      "[2826, 1, 1, 16099]\n",
      "[2826, 1, 1, 16110]\n",
      "[2826, 1, 1, 16123]\n",
      "[2826, 1, 1, 16136]\n",
      "[2826, 1, 1, 16149]\n",
      "[2826, 1, 1, 16161]\n",
      "[2826, 1, 1, 16172]\n",
      "[2826, 1, 1, 16183]\n",
      "[2826, 1, 1, 16195]\n",
      "[2826, 1, 1, 16206]\n",
      "[2826, 1, 1, 16217]\n",
      "[2826, 1, 1, 16229]\n",
      "[2826, 1, 1, 16241]\n",
      "[2826, 1, 1, 16253]\n",
      "[2826, 1, 1, 16265]\n",
      "[2826, 1, 1, 16276]\n",
      "[2826, 1, 1, 16287]\n",
      "[2826, 1, 1, 16298]\n",
      "[2826, 1, 1, 16309]\n",
      "[2826, 1, 1, 16320]\n",
      "[2826, 1, 1, 16331]\n",
      "[2826, 1, 1, 16342]\n",
      "[2826, 1, 1, 16354]\n",
      "[2826, 1, 1, 16366]\n",
      "[2826, 1, 1, 16377]\n",
      "[2826, 1, 1, 16388]\n",
      "[2826, 1, 1, 16400]\n",
      "[2826, 1, 1, 16412]\n",
      "[2826, 1, 1, 16424]\n",
      "[2826, 1, 1, 16436]\n",
      "[2826, 1, 1, 16447]\n",
      "[2826, 1, 1, 16457]\n",
      "[2826, 1, 1, 16468]\n",
      "[2826, 1, 1, 16480]\n",
      "[2826, 1, 1, 16493]\n",
      "[2826, 1, 1, 16506]\n",
      "[2826, 1, 1, 16519]\n",
      "[2826, 1, 1, 16531]\n",
      "[2826, 1, 1, 16542]\n",
      "[2826, 1, 1, 16553]\n",
      "[2826, 1, 1, 16564]\n",
      "[2826, 1, 1, 16576]\n",
      "[2826, 1, 1, 16588]\n",
      "[2826, 1, 1, 16600]\n",
      "[2826, 1, 1, 16611]\n",
      "[2826, 1, 1, 16623]\n",
      "[2826, 1, 1, 16635]\n",
      "[2826, 1, 1, 16646]\n",
      "[2826, 1, 1, 16657]\n",
      "[2826, 1, 1, 16668]\n",
      "[2826, 1, 1, 16680]\n",
      "[2826, 1, 1, 16693]\n",
      "[2826, 1, 1, 16706]\n",
      "[2826, 1, 1, 16717]\n",
      "[2826, 1, 1, 16729]\n",
      "[2826, 1, 1, 16741]\n",
      "[2826, 1, 1, 16753]\n",
      "[2826, 1, 1, 16765]\n",
      "[2826, 1, 1, 16776]\n",
      "[2826, 1, 1, 16787]\n",
      "[2826, 1, 1, 16798]\n",
      "[2826, 1, 1, 16808]\n",
      "[2826, 1, 1, 16820]\n",
      "[2826, 1, 1, 16832]\n",
      "[2826, 1, 1, 16844]\n",
      "[2826, 1, 1, 16856]\n",
      "[2826, 1, 1, 16868]\n",
      "[2826, 1, 1, 16880]\n",
      "[2826, 1, 1, 16892]\n",
      "[2826, 1, 1, 16905]\n",
      "[2826, 1, 1, 16917]\n",
      "[2826, 1, 1, 16928]\n",
      "[2826, 1, 1, 16939]\n",
      "[2826, 1, 1, 16950]\n",
      "[2826, 1, 1, 16961]\n",
      "[2826, 1, 1, 16973]\n",
      "[2826, 1, 1, 16985]\n",
      "[2826, 1, 1, 16997]\n",
      "[2826, 1, 1, 17009]\n",
      "[2826, 1, 1, 17020]\n",
      "[2826, 1, 1, 17032]\n",
      "[2826, 1, 1, 17043]\n",
      "[2826, 1, 1, 17055]\n",
      "[2826, 1, 1, 17068]\n",
      "[2826, 1, 1, 17079]\n",
      "[2826, 1, 1, 17091]\n",
      "[2826, 1, 1, 17103]\n",
      "[2826, 1, 1, 17115]\n",
      "[2826, 1, 1, 17126]\n",
      "[2826, 1, 1, 17137]\n",
      "[2826, 1, 1, 17149]\n",
      "[2826, 1, 1, 17160]\n",
      "[2826, 1, 1, 17170]\n",
      "[2826, 1, 1, 17181]\n",
      "[2826, 1, 1, 17193]\n",
      "[2826, 1, 1, 17205]\n",
      "[2826, 1, 1, 17217]\n",
      "[2826, 1, 1, 17229]\n",
      "[2826, 1, 1, 17241]\n",
      "[2826, 1, 1, 17254]\n",
      "[2826, 1, 1, 17267]\n",
      "[2826, 1, 1, 17279]\n",
      "[2826, 1, 1, 17290]\n",
      "[2826, 1, 1, 17301]\n",
      "[2826, 1, 1, 17312]\n",
      "[2826, 1, 1, 17324]\n",
      "[2826, 1, 1, 17336]\n",
      "[2826, 1, 1, 17347]\n",
      "[2826, 1, 1, 17358]\n",
      "[2826, 1, 1, 17370]\n",
      "[2826, 1, 1, 17382]\n",
      "[2826, 1, 1, 17394]\n",
      "[2826, 1, 1, 17406]\n",
      "[2826, 1, 1, 17417]\n",
      "[2826, 1, 1, 17428]\n",
      "[2826, 1, 1, 17439]\n",
      "[2826, 1, 1, 17450]\n",
      "[2826, 1, 1, 17463]\n",
      "[2826, 1, 1, 17476]\n",
      "[2826, 1, 1, 17489]\n",
      "[2826, 1, 1, 17500]\n",
      "[2826, 1, 1, 17511]\n",
      "[2826, 1, 1, 17523]\n",
      "[2826, 1, 1, 17535]\n",
      "[2826, 1, 1, 17546]\n",
      "[2826, 1, 1, 17557]\n",
      "[2826, 1, 1, 17569]\n",
      "[2826, 1, 1, 17581]\n",
      "[2826, 1, 1, 17593]\n",
      "[2826, 1, 1, 17604]\n",
      "[2826, 1, 1, 17616]\n",
      "[2826, 1, 1, 17628]\n",
      "[2826, 1, 1, 17640]\n",
      "[2826, 1, 1, 17652]\n",
      "[2826, 1, 1, 17663]\n",
      "[2826, 1, 1, 17674]\n",
      "[2826, 1, 1, 17686]\n",
      "[2826, 1, 1, 17698]\n",
      "[2826, 1, 1, 17710]\n",
      "[2826, 1, 1, 17722]\n",
      "[2826, 1, 1, 17734]\n",
      "[2826, 1, 1, 17746]\n",
      "[2826, 1, 1, 17757]\n",
      "[2826, 1, 1, 17768]\n",
      "[2826, 1, 1, 17779]\n",
      "[2826, 1, 1, 17790]\n",
      "[2826, 1, 1, 17802]\n",
      "[2826, 1, 1, 17813]\n",
      "[2826, 1, 1, 17824]\n",
      "[2826, 1, 1, 17835]\n",
      "[2826, 1, 1, 17847]\n",
      "[2826, 1, 1, 17859]\n",
      "[2826, 1, 1, 17871]\n",
      "[2826, 1, 1, 17882]\n",
      "[2826, 1, 1, 17894]\n",
      "[2826, 1, 1, 17907]\n",
      "[2826, 1, 1, 17919]\n",
      "[2826, 1, 1, 17931]\n",
      "[2826, 1, 1, 17943]\n",
      "[2826, 1, 1, 17955]\n",
      "[2826, 1, 1, 17967]\n",
      "[2826, 1, 1, 17979]\n",
      "[2826, 1, 1, 17991]\n",
      "[2826, 1, 1, 18003]\n",
      "[2826, 1, 1, 18014]\n",
      "[2826, 1, 1, 18025]\n",
      "[2826, 1, 1, 18037]\n",
      "[2826, 1, 1, 18049]\n",
      "[2826, 1, 1, 18061]\n",
      "[2826, 1, 1, 18073]\n",
      "[2826, 1, 1, 18085]\n",
      "[2826, 1, 1, 18097]\n",
      "[2826, 1, 1, 18108]\n",
      "[2826, 1, 1, 18119]\n",
      "[2826, 1, 1, 18130]\n",
      "[2826, 1, 1, 18142]\n",
      "[2826, 1, 1, 18153]\n",
      "[2826, 1, 1, 18165]\n",
      "[2826, 1, 1, 18177]\n",
      "[2826, 1, 1, 18189]\n",
      "[2826, 1, 1, 18201]\n",
      "[2826, 1, 1, 18212]\n",
      "[2826, 1, 1, 18223]\n",
      "[2826, 1, 1, 18234]\n",
      "[2826, 1, 1, 18244]\n",
      "[2826, 1, 1, 18255]\n",
      "[2826, 1, 1, 18267]\n",
      "[2826, 1, 1, 18279]\n",
      "[2826, 1, 1, 18291]\n",
      "[2826, 1, 1, 18303]\n",
      "[2826, 1, 1, 18315]\n",
      "[2826, 1, 1, 18327]\n",
      "[2826, 1, 1, 18338]\n",
      "[2826, 1, 1, 18349]\n",
      "[2826, 1, 1, 18360]\n",
      "[2826, 1, 1, 18370]\n",
      "[2826, 1, 1, 18382]\n",
      "[2826, 1, 1, 18394]\n",
      "[2826, 1, 1, 18406]\n",
      "[2826, 1, 1, 18418]\n",
      "[2826, 1, 1, 18430]\n",
      "[2826, 1, 1, 18442]\n",
      "[2826, 1, 1, 18454]\n",
      "[2826, 1, 1, 18466]\n",
      "[2826, 1, 1, 18478]\n",
      "[2826, 1, 1, 18490]\n",
      "[2826, 1, 1, 18502]\n",
      "[2826, 1, 1, 18513]\n",
      "[2826, 1, 1, 18524]\n",
      "[2826, 1, 1, 18536]\n",
      "[2826, 1, 1, 18547]\n",
      "[2826, 1, 1, 18559]\n",
      "[2826, 1, 1, 18571]\n",
      "[2826, 1, 1, 18583]\n",
      "[2826, 1, 1, 18595]\n",
      "[2826, 1, 1, 18607]\n",
      "[2826, 1, 1, 18619]\n",
      "[2826, 1, 1, 18630]\n",
      "[2826, 1, 1, 18641]\n",
      "[2826, 1, 1, 18652]\n",
      "[2826, 1, 1, 18664]\n",
      "[2826, 1, 1, 18676]\n",
      "[2826, 1, 1, 18688]\n",
      "[2826, 1, 1, 18700]\n",
      "[2826, 1, 1, 18712]\n",
      "[2826, 1, 1, 18724]\n",
      "[2826, 1, 1, 18736]\n",
      "[2826, 1, 1, 18748]\n",
      "[2826, 1, 1, 18759]\n",
      "[2826, 1, 1, 18770]\n",
      "[2826, 1, 1, 18782]\n",
      "[2826, 1, 1, 18793]\n",
      "[2826, 1, 1, 18804]\n",
      "[2826, 1, 1, 18815]\n",
      "[2826, 1, 1, 18828]\n",
      "[2826, 1, 1, 18839]\n",
      "[2826, 1, 1, 18850]\n",
      "[2826, 1, 1, 18863]\n",
      "[2826, 1, 1, 18876]\n",
      "[2826, 1, 1, 18888]\n",
      "[2826, 1, 1, 18899]\n",
      "[2826, 1, 1, 18911]\n",
      "[2826, 1, 1, 18923]\n",
      "[2826, 1, 1, 18935]\n",
      "[2826, 1, 1, 18946]\n",
      "[2826, 1, 1, 18957]\n",
      "[2826, 1, 1, 18968]\n",
      "[2826, 1, 1, 18979]\n",
      "[2826, 1, 1, 18990]\n",
      "[2826, 1, 1, 19002]\n",
      "[2826, 1, 1, 19015]\n",
      "[2826, 1, 1, 19028]\n",
      "[2826, 1, 1, 19040]\n",
      "[2826, 1, 1, 19052]\n",
      "[2826, 1, 1, 19064]\n",
      "[2826, 1, 1, 19076]\n",
      "[2826, 1, 1, 19087]\n",
      "[2826, 1, 1, 19098]\n",
      "[2826, 1, 1, 19109]\n",
      "[2826, 1, 1, 19120]\n",
      "[2826, 1, 1, 19132]\n",
      "[2826, 1, 1, 19144]\n",
      "[2826, 1, 1, 19155]\n",
      "[2826, 1, 1, 19166]\n",
      "[2826, 1, 1, 19177]\n",
      "[2826, 1, 1, 19189]\n",
      "[2826, 1, 1, 19202]\n",
      "[2826, 1, 1, 19215]\n",
      "[2826, 1, 1, 19228]\n",
      "[2826, 1, 1, 19239]\n",
      "[2826, 1, 1, 19250]\n",
      "[2826, 1, 1, 19261]\n",
      "[2826, 1, 1, 19272]\n",
      "[2826, 1, 1, 19283]\n",
      "[2826, 1, 1, 19295]\n",
      "[2826, 1, 1, 19307]\n",
      "[2826, 1, 1, 19319]\n",
      "[2827, 1, 1, 19330]\n",
      "[2827, 1, 1, 19341]\n",
      "[2827, 1, 1, 19354]\n",
      "[2827, 1, 1, 19367]\n",
      "[2827, 3, 1, 19380]\n",
      "[2827, 36, 1, 19393]\n",
      "[2827, 70, 1, 19405]\n",
      "[2827, 104, 1, 19417]\n",
      "[2827, 138, 1, 19428]\n",
      "[2827, 166, 1, 19439]\n",
      "[2827, 196, 1, 19450]\n",
      "[2827, 229, 1, 19461]\n",
      "[2827, 268, 1, 19471]\n",
      "[2827, 307, 1, 19482]\n",
      "[2827, 343, 1, 19494]\n",
      "[2827, 373, 1, 19507]\n",
      "[2827, 401, 1, 19519]\n",
      "[2827, 426, 1, 19530]\n",
      "[2827, 452, 1, 19541]\n",
      "[2827, 477, 1, 19552]\n",
      "[2827, 502, 1, 19563]\n",
      "[2827, 525, 1, 19574]\n",
      "[2828, 545, 1, 19586]\n",
      "[2828, 566, 1, 19598]\n",
      "[2829, 590, 1, 19610]\n",
      "[2829, 613, 1, 19622]\n",
      "[2829, 636, 1, 19634]\n",
      "[2829, 652, 1, 19646]\n",
      "[2829, 658, 1, 19658]\n",
      "[2829, 658, 1, 19669]\n",
      "[2829, 658, 1, 19680]\n",
      "[2829, 658, 1, 19691]\n",
      "[2829, 658, 1, 19703]\n",
      "[2829, 658, 1, 19715]\n",
      "[2829, 658, 1, 19726]\n",
      "[2829, 658, 1, 19737]\n",
      "[2829, 662, 1, 19749]\n",
      "[2829, 678, 1, 19761]\n",
      "[2829, 680, 1, 19773]\n",
      "[2829, 685, 1, 19785]\n",
      "[2829, 695, 1, 19797]\n",
      "[2829, 705, 1, 19809]\n",
      "[2829, 706, 1, 19820]\n",
      "[2829, 706, 1, 19832]\n",
      "[2829, 706, 1, 19844]\n",
      "[2829, 706, 1, 19856]\n",
      "[2829, 706, 1, 19868]\n",
      "[2829, 706, 1, 19879]\n",
      "[2829, 720, 1, 19890]\n",
      "[2829, 734, 1, 19901]\n",
      "[2829, 740, 1, 19913]\n",
      "[2829, 740, 1, 19924]\n",
      "[2829, 740, 1, 19936]\n",
      "[2829, 740, 1, 19948]\n",
      "[2829, 740, 1, 19960]\n",
      "[2829, 740, 1, 19972]\n",
      "[2829, 740, 1, 19984]\n",
      "[2829, 740, 1, 19996]\n",
      "[2829, 740, 1, 20008]\n",
      "[2829, 740, 1, 20019]\n",
      "[2829, 740, 1, 20031]\n",
      "[2829, 740, 1, 20044]\n",
      "[2829, 740, 1, 20056]\n",
      "[2829, 740, 1, 20068]\n",
      "[2829, 740, 1, 20079]\n",
      "[2829, 740, 1, 20090]\n",
      "[2829, 740, 1, 20102]\n",
      "[2829, 740, 1, 20115]\n",
      "[2829, 740, 1, 20128]\n",
      "[2829, 740, 1, 20140]\n",
      "[2829, 740, 1, 20152]\n",
      "[2829, 740, 1, 20164]\n",
      "[2829, 740, 1, 20176]\n",
      "[2829, 740, 1, 20188]\n",
      "[2829, 740, 1, 20201]\n",
      "[2829, 740, 1, 20213]\n",
      "[2829, 740, 1, 20224]\n",
      "[2829, 740, 1, 20235]\n",
      "[2829, 740, 1, 20246]\n",
      "[2829, 740, 1, 20257]\n",
      "[2829, 740, 1, 20269]\n",
      "[2829, 740, 1, 20281]\n",
      "[2829, 740, 1, 20292]\n",
      "[2829, 747, 1, 20303]\n",
      "[2829, 747, 1, 20314]\n",
      "[2829, 747, 1, 20326]\n",
      "[2829, 747, 1, 20338]\n",
      "[2829, 747, 1, 20350]\n",
      "[2829, 747, 1, 20363]\n",
      "[2829, 747, 1, 20374]\n",
      "[2829, 747, 1, 20385]\n",
      "[2829, 747, 1, 20396]\n",
      "[2829, 748, 1, 20407]\n",
      "[2829, 749, 1, 20419]\n",
      "[2829, 749, 1, 20431]\n",
      "[2829, 749, 1, 20443]\n",
      "[2829, 749, 1, 20456]\n",
      "[2829, 749, 1, 20469]\n",
      "[2829, 749, 1, 20481]\n",
      "[2829, 749, 1, 20492]\n",
      "[2829, 749, 1, 20504]\n",
      "[2829, 749, 1, 20516]\n",
      "[2829, 749, 1, 20528]\n",
      "[2829, 749, 1, 20540]\n",
      "[2829, 749, 1, 20552]\n",
      "[2829, 749, 1, 20563]\n",
      "[2829, 749, 1, 20575]\n",
      "[2829, 749, 1, 20586]\n",
      "[2829, 749, 1, 20597]\n",
      "[2829, 749, 1, 20609]\n",
      "[2829, 749, 1, 20621]\n",
      "[2829, 749, 1, 20633]\n",
      "[2829, 749, 1, 20644]\n",
      "[2829, 749, 1, 20655]\n",
      "[2829, 749, 1, 20667]\n",
      "[2829, 749, 1, 20680]\n",
      "[2829, 749, 1, 20693]\n",
      "[2829, 749, 1, 20704]\n",
      "[2829, 749, 1, 20715]\n",
      "[2829, 749, 1, 20726]\n",
      "[2829, 749, 1, 20738]\n",
      "[2829, 749, 1, 20750]\n",
      "[2829, 749, 1, 20761]\n",
      "[2829, 749, 1, 20772]\n",
      "[2829, 752, 1, 20783]\n",
      "[2829, 752, 1, 20795]\n",
      "[2829, 752, 1, 20806]\n",
      "[2829, 752, 1, 20817]\n",
      "[2829, 752, 1, 20829]\n",
      "[2829, 752, 1, 20841]\n",
      "[2829, 752, 1, 20853]\n",
      "[2829, 752, 1, 20865]\n",
      "[2829, 752, 1, 20877]\n",
      "[2829, 752, 1, 20888]\n",
      "[2829, 752, 1, 20899]\n",
      "[2829, 752, 1, 20911]\n",
      "[2829, 752, 1, 20924]\n",
      "[2829, 752, 1, 20936]\n",
      "[2829, 752, 1, 20947]\n",
      "[2829, 754, 1, 20959]\n",
      "[2829, 754, 1, 20971]\n",
      "[2829, 754, 1, 20984]\n",
      "[2829, 754, 1, 20996]\n",
      "[2829, 754, 1, 21008]\n",
      "[2829, 762, 1, 21020]\n",
      "[2829, 765, 1, 21031]\n",
      "[2829, 765, 1, 21042]\n",
      "[2829, 765, 1, 21054]\n",
      "[2829, 765, 1, 21066]\n",
      "[2829, 765, 1, 21078]\n",
      "[2829, 765, 1, 21089]\n",
      "[2829, 765, 1, 21101]\n",
      "[2829, 765, 1, 21113]\n",
      "[2829, 765, 1, 21124]\n",
      "[2829, 765, 1, 21135]\n",
      "[2829, 765, 1, 21146]\n",
      "[2829, 765, 1, 21157]\n",
      "[2829, 765, 1, 21169]\n",
      "[2829, 765, 1, 21181]\n",
      "[2829, 765, 1, 21192]\n",
      "[2829, 766, 1, 21203]\n",
      "[2829, 766, 1, 21214]\n",
      "[2829, 766, 1, 21226]\n",
      "[2829, 766, 1, 21238]\n",
      "[2829, 767, 1, 21250]\n",
      "[2829, 767, 1, 21262]\n",
      "[2829, 767, 1, 21274]\n",
      "[2829, 767, 1, 21286]\n",
      "[2829, 767, 1, 21297]\n",
      "[2829, 768, 1, 21308]\n",
      "[2829, 768, 1, 21320]\n",
      "[2829, 768, 1, 21332]\n",
      "[2829, 768, 1, 21344]\n",
      "[2829, 768, 1, 21356]\n",
      "[2829, 769, 1, 21368]\n",
      "[2829, 769, 1, 21380]\n",
      "[2829, 769, 1, 21391]\n",
      "[2829, 769, 1, 21403]\n",
      "[2829, 769, 1, 21415]\n",
      "[2829, 769, 1, 21426]\n",
      "[2829, 769, 1, 21437]\n",
      "[2829, 769, 1, 21448]\n",
      "[2829, 769, 1, 21460]\n",
      "[2829, 769, 1, 21472]\n",
      "[2829, 769, 1, 21484]\n",
      "[2829, 769, 1, 21496]\n",
      "[2829, 769, 1, 21507]\n",
      "[2829, 769, 1, 21518]\n",
      "[2829, 769, 1, 21530]\n",
      "[2829, 769, 1, 21542]\n",
      "[2829, 769, 1, 21553]\n",
      "[2829, 769, 1, 21564]\n",
      "[2829, 769, 1, 21576]\n",
      "[2829, 769, 1, 21588]\n",
      "[2829, 769, 1, 21600]\n",
      "[2829, 769, 1, 21612]\n",
      "[2829, 769, 1, 21624]\n",
      "[2829, 769, 1, 21635]\n",
      "[2829, 769, 1, 21646]\n",
      "[2829, 769, 1, 21657]\n",
      "[2829, 769, 1, 21668]\n",
      "[2829, 769, 1, 21679]\n",
      "[2829, 769, 1, 21690]\n",
      "[2829, 769, 1, 21701]\n",
      "[2829, 769, 1, 21712]\n",
      "[2829, 769, 1, 21724]\n",
      "[2829, 769, 1, 21735]\n",
      "[2829, 769, 1, 21746]\n",
      "[2829, 769, 1, 21758]\n",
      "[2829, 769, 1, 21771]\n",
      "[2829, 769, 1, 21784]\n",
      "[2829, 769, 1, 21796]\n",
      "[2829, 769, 1, 21808]\n",
      "[2829, 769, 1, 21819]\n",
      "[2829, 769, 1, 21830]\n",
      "[2829, 769, 1, 21842]\n",
      "[2829, 769, 1, 21853]\n",
      "[2829, 769, 1, 21864]\n",
      "[2829, 769, 1, 21875]\n",
      "[2829, 769, 1, 21886]\n",
      "[2829, 769, 1, 21898]\n",
      "[2829, 769, 1, 21910]\n",
      "[2829, 769, 1, 21923]\n",
      "[2829, 769, 1, 21936]\n",
      "[2829, 769, 1, 21949]\n",
      "[2829, 769, 1, 21961]\n",
      "[2829, 769, 1, 21973]\n",
      "[2829, 769, 1, 21985]\n",
      "[2829, 769, 1, 21997]\n",
      "[2829, 769, 1, 22009]\n",
      "[2829, 769, 1, 22020]\n",
      "[2829, 769, 1, 22031]\n",
      "[2829, 769, 1, 22043]\n",
      "[2829, 769, 1, 22056]\n",
      "[2829, 769, 2, 22069]\n",
      "[2829, 769, 2, 22080]\n",
      "[2829, 769, 2, 22091]\n",
      "[2829, 769, 3, 22103]\n",
      "[2829, 769, 4, 22115]\n",
      "[2829, 769, 4, 22126]\n",
      "[2829, 769, 15, 22138]\n",
      "[2829, 769, 41, 22150]\n",
      "[2829, 769, 54, 22162]\n",
      "[2829, 769, 78, 22174]\n",
      "[2829, 769, 95, 22186]\n",
      "[2829, 769, 122, 22198]\n",
      "[2829, 769, 145, 22210]\n",
      "[2829, 769, 172, 22221]\n",
      "[2829, 769, 195, 22232]\n",
      "[2829, 769, 213, 22243]\n",
      "[2829, 769, 216, 22255]\n",
      "[2829, 769, 241, 22267]\n",
      "[2829, 769, 266, 22280]\n",
      "[2829, 769, 283, 22293]\n",
      "[2829, 769, 307, 22305]\n",
      "[2829, 769, 322, 22316]\n",
      "[2829, 769, 339, 22327]\n",
      "[2829, 769, 357, 22339]\n",
      "[2829, 769, 362, 22350]\n",
      "[2829, 769, 366, 22361]\n",
      "[2829, 769, 367, 22372]\n",
      "[2829, 769, 368, 22384]\n",
      "[2829, 769, 368, 22396]\n",
      "[2829, 769, 368, 22408]\n",
      "[2829, 769, 368, 22420]\n",
      "[2829, 769, 368, 22432]\n",
      "[2829, 769, 369, 22443]\n",
      "[2829, 769, 379, 22455]\n",
      "[2829, 769, 389, 22466]\n",
      "[2829, 769, 399, 22476]\n",
      "[2829, 769, 404, 22488]\n",
      "[2829, 769, 404, 22500]\n",
      "[2829, 769, 406, 22512]\n",
      "[2829, 769, 411, 22524]\n",
      "[2829, 769, 412, 22537]\n",
      "[2829, 769, 412, 22549]\n",
      "[2829, 769, 412, 22561]\n",
      "[2829, 769, 412, 22572]\n",
      "[2829, 769, 412, 22584]\n",
      "[2829, 769, 412, 22595]\n",
      "[2829, 769, 412, 22606]\n",
      "[2829, 769, 412, 22617]\n",
      "[2829, 769, 412, 22628]\n",
      "[2829, 769, 415, 22640]\n",
      "[2829, 769, 415, 22653]\n",
      "[2829, 769, 415, 22665]\n",
      "[2829, 769, 415, 22676]\n",
      "[2829, 769, 415, 22688]\n",
      "[2829, 769, 415, 22699]\n",
      "[2829, 769, 415, 22711]\n",
      "[2829, 769, 415, 22722]\n",
      "[2829, 769, 415, 22734]\n",
      "[2829, 769, 415, 22746]\n",
      "[2829, 769, 415, 22758]\n",
      "[2829, 769, 415, 22770]\n",
      "[2829, 769, 415, 22782]\n",
      "[2829, 769, 415, 22794]\n",
      "[2829, 769, 415, 22806]\n",
      "[2829, 769, 415, 22818]\n",
      "[2829, 769, 415, 22829]\n",
      "[2829, 769, 415, 22840]\n",
      "[2829, 769, 415, 22851]\n",
      "[2829, 769, 415, 22863]\n",
      "[2829, 769, 415, 22875]\n",
      "[2829, 769, 415, 22886]\n",
      "[2829, 769, 415, 22898]\n",
      "[2829, 769, 415, 22910]\n",
      "[2829, 769, 415, 22921]\n",
      "[2829, 769, 415, 22932]\n",
      "[2829, 769, 415, 22944]\n",
      "[2829, 769, 415, 22956]\n",
      "[2829, 769, 415, 22967]\n",
      "[2829, 769, 415, 22979]\n",
      "[2829, 769, 415, 22991]\n",
      "[2829, 769, 415, 23003]\n",
      "[2829, 769, 415, 23015]\n",
      "[2829, 769, 415, 23028]\n",
      "[2829, 769, 415, 23041]\n",
      "[2829, 769, 415, 23053]\n",
      "[2829, 769, 415, 23064]\n",
      "[2829, 769, 415, 23076]\n",
      "[2829, 769, 415, 23087]\n",
      "[2829, 769, 415, 23099]\n",
      "[2829, 769, 415, 23111]\n",
      "[2829, 769, 415, 23123]\n",
      "[2829, 769, 415, 23135]\n",
      "[2829, 769, 415, 23146]\n",
      "[2829, 769, 415, 23158]\n",
      "[2829, 769, 415, 23170]\n",
      "[2829, 769, 415, 23183]\n",
      "[2829, 769, 415, 23194]\n",
      "[2829, 769, 415, 23206]\n",
      "[2829, 769, 415, 23219]\n",
      "[2829, 769, 415, 23231]\n",
      "[2829, 769, 415, 23243]\n",
      "[2829, 769, 415, 23255]\n",
      "[2829, 769, 415, 23267]\n",
      "[2829, 769, 415, 23279]\n",
      "[2829, 769, 415, 23290]\n",
      "[2829, 769, 415, 23301]\n",
      "[2829, 769, 415, 23313]\n",
      "[2829, 769, 415, 23325]\n",
      "[2829, 769, 415, 23341]\n",
      "[2829, 769, 415, 23435]\n",
      "[2829, 769, 415, 23551]\n",
      "[2829, 769, 415, 23672]\n",
      "[2829, 769, 415, 23794]\n",
      "[2829, 769, 415, 23916]\n",
      "[2829, 769, 415, 24038]\n",
      "[2829, 769, 415, 24161]\n",
      "[2829, 769, 415, 24284]\n",
      "[2829, 769, 415, 24407]\n",
      "[2829, 769, 415, 24530]\n",
      "[2829, 769, 415, 24654]\n",
      "[2829, 769, 415, 24777]\n",
      "[2829, 769, 415, 24900]\n",
      "[2829, 769, 415, 25024]\n",
      "[2829, 769, 415, 25148]\n",
      "[2829, 769, 415, 25268]\n",
      "[2829, 769, 415, 25388]\n",
      "[2829, 769, 415, 25438]\n",
      "[2829, 769, 415, 25549]\n",
      "[2829, 769, 415, 25674]\n",
      "[2829, 769, 415, 25801]\n",
      "[2829, 769, 415, 25929]\n",
      "[2829, 769, 415, 26058]\n",
      "[2829, 769, 415, 26187]\n",
      "[2829, 769, 415, 26315]\n",
      "[2829, 769, 415, 26400]\n",
      "[2829, 769, 415, 26445]\n",
      "[2829, 769, 415, 26549]\n",
      "[2829, 769, 415, 26637]\n",
      "[2829, 769, 415, 26682]\n",
      "[2829, 769, 415, 26727]\n",
      "[2829, 769, 415, 26735]\n",
      "[2829, 769, 415, 26782]\n",
      "[2829, 769, 415, 26863]\n",
      "[2829, 769, 415, 26959]\n",
      "[2829, 769, 415, 27064]\n",
      "[2829, 769, 415, 27175]\n",
      "[2829, 769, 415, 27288]\n",
      "[2829, 769, 415, 27401]\n"
     ]
    }
   ],
   "source": [
    "# 累积脉冲测试\n",
    "\n",
    "import serial\n",
    "import time\n",
    "import threading\n",
    "motor_pwm=[1500,1500,1500,1500]\n",
    "motor_pulses_per_revolutions = [0,0,0,0]\n",
    "\n",
    "# list all serial ports available on the system\n",
    "import serial.tools.list_ports\n",
    "ports = serial.tools.list_ports.comports()\n",
    "for port in ports:\n",
    "    print(port.description,port.device)\n",
    "\n",
    "serport=\"COM3\"\n",
    "serbaud=115200\n",
    "running=True\n",
    "ser=serial.Serial(serport,serbaud)\n",
    "while True:\n",
    "    time.sleep(0.1)\n",
    "    data=ser.read_all()\n",
    "    if data==b'':\n",
    "        continue\n",
    "    if data.find(b'[FinishInit]')!=-1 :\n",
    "        print('FinishInit')\n",
    "        break\n",
    "    else:\n",
    "        print(data)\n",
    "\n",
    "def fun():\n",
    "    # Motor pulses per revolution test code\n",
    "    running_time_set=0.1\n",
    "    motor_number = 9\n",
    "    \n",
    "    get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "    i=0\n",
    "    \n",
    "    start_time=time.time()\n",
    "\n",
    "    while True:\n",
    "        if not running:\n",
    "            break\n",
    "        # make sure every loop running time is 100ms\n",
    "        cur_time = time.time()\n",
    "        spd_set_cmd=\"{{#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!}}\".format(6,motor_pwm[0],7,motor_pwm[1],8,motor_pwm[2],9,motor_pwm[3])\n",
    "        # print(spd_set_cmd)\n",
    "        retcode=ser.write(spd_set_cmd.encode())\n",
    "        time.sleep(0.015)\n",
    "        ret=ser.read_all().decode()\n",
    "        # print(ret)\n",
    "        # print(\"[{:03d}]\".format(i),motor_pulses_per_revolutions)\n",
    "        for num in range(4):\n",
    "            motor_number=num+6\n",
    "            get_speed_cmd=\"#{:03d}PSPD!\".format(motor_number)\n",
    "            retcode=ser.write(get_speed_cmd.encode())\n",
    "            time.sleep(0.015)\n",
    "            ret=ser.read_all().decode()\n",
    "            # print(\"[{:03d}]\".format(i),ret)\n",
    "            ret_int=ret[ret.find('=')+1:ret.find('/')]\n",
    "            motor_pulses_per_revolutions[num] += int(ret_int)\n",
    "        i+=1\n",
    "        print(motor_pulses_per_revolutions)\n",
    "        \n",
    "        running_time = time.time() - cur_time\n",
    "        if running_time < running_time_set:\n",
    "            # print(\"[NO]\")\n",
    "            time.sleep(running_time_set - running_time)\n",
    "        else:\n",
    "            # print(\"[OVER]\",running_time)\n",
    "            pass\n",
    "\n",
    "#创建一个线程，执行fun函数\n",
    "t=threading.Thread(target=fun)\n",
    "t.start()\n",
    "import tkinter as tk\n",
    "\n",
    "# motor_pwm=[1500, 1500, 1500, 1500]\n",
    "\n",
    "def main():\n",
    "    def update_motor_pwm(event):\n",
    "        global motor_pwm\n",
    "        # 获取滑块的值并更新motor_pwm\n",
    "        motor_pwm = [scale1.get(), scale2.get(), scale3.get(), scale4.get()]\n",
    "        # print(f\"Motor PWM Values: {motor_pwm}\")\n",
    "\n",
    "    # 创建主窗口\n",
    "    root = tk.Tk()\n",
    "    root.title(\"Motor PWM Control\")\n",
    "\n",
    "    # 创建四个滑块\n",
    "    scale1 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 1 PWM\")\n",
    "    scale1.set(1500)  # 设置初始值\n",
    "    scale1.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale2 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 2 PWM\")\n",
    "    scale2.set(1500)  # 设置初始值\n",
    "    scale2.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale3 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 3 PWM\")\n",
    "    scale3.set(1500)  # 设置初始值\n",
    "    scale3.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale4 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 4 PWM\")\n",
    "    scale4.set(1500)  # 设置初始值\n",
    "    scale4.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    # 创建一个按钮，用于更新motor_pwm值\n",
    "    update_button = tk.Button(root, text=\"Update PWM\", command=update_motor_pwm)\n",
    "    update_button.pack(pady=10)\n",
    "\n",
    "    # 绑定事件处理函数:当滑块的值发生变化时，调用update_motor_pwm函数\n",
    "    scale1.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale2.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale3.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale4.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "\n",
    "    # 创建一个标签，用于显示当前的motor_pulses_per_revolutions值\n",
    "    label = tk.Label(root, text=\"Motor Pulses Per Revolutions:\")\n",
    "    label.pack(pady=10)\n",
    "    # 每隔100ms更新一次label显示的值\n",
    "    def update_label():\n",
    "        # 获取当前的motor_pulses_per_revolutions值\n",
    "        global motor_pulses_per_revolutions\n",
    "        label.config(text=f\"{motor_pulses_per_revolutions}\")\n",
    "        # 再次调用本函数，以便于每隔100ms更新一次label显示的值\n",
    "        root.after(100, update_label)\n",
    "\n",
    "    # 运行主循环\n",
    "    root.mainloop()\n",
    "\n",
    "    running=False\n",
    "    time.sleep(0.5)\n",
    "\n",
    "    #程序结束，停止线程\n",
    "    t.join()\n",
    "\n",
    "    # 关闭串口\n",
    "    ser.close()\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    main()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "# AtCar类定义\n",
    "\n",
    "\n",
    "class AtCar:\n",
    "    \"\"\"\n",
    "    类AtCar的定义\n",
    "    Init函数参数:\n",
    "        串口号: serial_number\n",
    "        通信波特率: baud_rate\n",
    "    \"\"\"\n",
    "    def __init__(self, serial_number, baud_rate=115200):\n",
    "        self.serial_number = serial_number  # 串口号\n",
    "        self.baud_rate = baud_rate  # 通信波特率\n",
    "        self.ser_car = serial.Serial(serial_number, baud_rate, timeout=1)  # 打开串口，并设置读取超时时间为1秒\n",
    "        # 小车参数\n",
    "        self.wheel_radius = 0.04  # 轮子半径\n",
    "        self.wheel_y_distance = 0.195  # 轮子左右间距\n",
    "        self.wheel_x_distance = 0.13  # 轮子前后间距\n",
    "        # 电机参数\n",
    "        # 电机编号映射表\n",
    "        # self.motor_dict = {'left_front': 7, 'right_front': 6, 'left_rear': 9, 'right_rear': 8}\n",
    "        self.motor_nums = [7, 6, 9, 8]\n",
    "        # 各个电机每转一圈脉冲数，单位为脉冲数，分别对应 左前、右前、左后、右后 电机\n",
    "        self.motor_pulse_per_round = [749, 376, 377, 400]\n",
    "        self.motor_pwms = [1500, 1500, 1500, 1500]  # 电机当前PWM值\n",
    "        self.motors_speed = [0.0, 0.0, 0.0, 0.0]  # 电机当前速度\n",
    "        self.motor_direction = [0, 0, 0, 0]  # 电机当前方向\n",
    "        self.running = 1  # 线程运行标志, 1为运行，0为停止,-1为强制停止线程\n",
    "\n",
    "        # 创建线程\n",
    "        self.thread_car = threading.Thread(target=self.get_wheels_speed_and_set_motor_speed)\n",
    "        # 如果串口已经连接，则启动线程\n",
    "        self.init_serial_connection()\n",
    "        \n",
    "    def set_car_parameters(self, wheel_radius, wheel_y_distance, wheel_x_distance):\n",
    "        \"\"\"\n",
    "        设置小车参数\n",
    "        :param wheel_radius: 轮子半径\n",
    "        :param wheel_y_distance: 轮子左右间距\n",
    "        :param wheel_x_distance: 轮子前后间距\n",
    "        \"\"\"\n",
    "        self.wheel_radius = wheel_radius\n",
    "        self.wheel_y_distance = wheel_y_distance\n",
    "        self.wheel_x_distance = wheel_x_distance\n",
    "        \n",
    "    def get_car_parameters(self):\n",
    "        \"\"\"\n",
    "        获取小车参数\n",
    "        :return: 轮子半径、轮子左右间距、轮子前后间距\n",
    "        \"\"\"\n",
    "        return [self.wheel_radius, self.wheel_y_distance, self.wheel_x_distance]\n",
    "\n",
    "    def set_motor_parameters(self, motor_pulse_per_round, motor_pwms):\n",
    "        \"\"\"\n",
    "        设置电机参数\n",
    "        :param motor_pulse_per_round: 各个电机每转一圈脉冲数，单位为脉冲数，分别对应 左前、右前、左后、右后 电机\n",
    "        :param motor_pwms: 各个电机的初始PWM值\n",
    "        \"\"\"\n",
    "        self.motor_pulse_per_round = motor_pulse_per_round\n",
    "        self.motor_pwms = motor_pwms\n",
    "\n",
    "    def init_serial_connection(self):\n",
    "        \"\"\"\n",
    "        初始化串口连接，并启动线程\n",
    "        \"\"\"\n",
    "        try:\n",
    "            while True:\n",
    "                ret = self.ser_car.read_all().decode()\n",
    "                if '[FinishInit]' in ret:\n",
    "                    break\n",
    "            print(\"[INFO] 串口连接初始化完成\")\n",
    "            time.sleep(0.1)\n",
    "            # print(\"串口已连接，启动线程\")\n",
    "            self.thread_car.start()\n",
    "        except serial.SerialException as e:\n",
    "            print(f\"[ERROR] 串口连接初始化失败: {e}\")\n",
    "            self.ser_car.close()\n",
    "        except Exception as e:\n",
    "            print(f\"[ERROR] 串口连接初始化发生异常: {e}\")\n",
    "\n",
    "    def __del__(self):\n",
    "        \"\"\"\n",
    "        析构函数，在对象被删除时调用\n",
    "        \"\"\"\n",
    "        self.close()\n",
    "\n",
    "    def close(self):\n",
    "        \"\"\"\n",
    "        结束线程并关闭串口\n",
    "        \"\"\"\n",
    "        self.running = -1\n",
    "        time.sleep(0.1)  # 等待线程结束\n",
    "        try:\n",
    "            if self.thread_car.is_alive():\n",
    "                self.thread_car.join(timeout=0.5)  # 等待线程结束，最多等待0.5秒\n",
    "            self.ser_car.close()  # 关闭串口\n",
    "        except Exception as e:\n",
    "            print(f\"[ERROR] 关闭串口时发生异常: {e}\")\n",
    "\n",
    "    def get_motors_raw_speed(self):\n",
    "        \"\"\"\n",
    "        获取轮子速度, PWM值\n",
    "        \"\"\"\n",
    "        return self.motor_pwms\n",
    "    \n",
    "    def get_motor_raw_speed(self, motor_id):\n",
    "        \"\"\"\n",
    "        获取指定电机速度, PWM值\n",
    "        \"\"\"\n",
    "        return self.motor_pwms[motor_id]\n",
    "\n",
    "    def set_motors_pwm(self, motor_pwms):\n",
    "        \"\"\"\n",
    "        设置电机PWM值, 单位为脉冲数(500-2500)\n",
    "        \"\"\"\n",
    "        # 剔除超出范围的PWM值\n",
    "        for i in range(4):\n",
    "            if motor_pwms[i] < 500 or motor_pwms[i] > 2500:\n",
    "                motor_pwms[i] = int(self.motor_pwms[i])\n",
    "            else:\n",
    "                motor_pwms[i] = int(motor_pwms[i])\n",
    "            self.set_motor_speed(i,motor_pwms[i])\n",
    "\n",
    "    def get_wheels_speed_and_set_motor_speed(self):\n",
    "        \"\"\"\n",
    "        获取轮子速度，并设置电机速度，类私有函数\n",
    "        \"\"\"\n",
    "        running_time_set = 0.1\n",
    "\n",
    "        while self.running == 1:\n",
    "            cur_time = time.time()  # 获取当前时间，用于计算运行时间\n",
    "            spd_set_cmd = \"{{#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!#{:03d}P{:04d}T1000!}}\".format(\n",
    "                self.motor_nums[0], self.motor_pwms[0], self.motor_nums[1], self.motor_pwms[1], self.motor_nums[2], self.motor_pwms[2], self.motor_nums[3], self.motor_pwms[3])  # 生成设置电机速度的命令\n",
    "            try:\n",
    "                self.ser_car.write(spd_set_cmd.encode())  # 发送设置电机速度的命令\n",
    "            except serial.SerialException as e:\n",
    "                print(f\"[ERROR] 发送设置电机速度命令时发生错误: {e}\")\n",
    "                self.running = -1\n",
    "                break\n",
    "\n",
    "            time.sleep(0.015)  # 等待15ms，以便接收到返回值\n",
    "            ret = self.ser_car.read_all().decode()  # 接收返回值\n",
    "\n",
    "            # 对于每一个电机，获取脉冲数\n",
    "            for num in range(4):\n",
    "                motor_number = self.motor_nums[num]  # 获取电机编号\n",
    "                get_speed_cmd = \"#{:03d}PSPD!\".format(motor_number)  # 生成获取电机速度的命令\n",
    "                try:\n",
    "                    self.ser_car.write(get_speed_cmd.encode())  # 发送获取电机速度的命令\n",
    "                except serial.SerialException as e:\n",
    "                    print(f\"[ERROR] 发送获取电机{motor_number}速度命令时发生错误: {e}\")\n",
    "                    self.running = -1\n",
    "                    break\n",
    "\n",
    "                time.sleep(0.015)  # 等待15ms，以便接收到返回值\n",
    "                ret = self.ser_car.read_all().decode()  # 接收返回值\n",
    "                try:\n",
    "                    ret_int = int(ret.split('=')[1].split('/')[0])  # 提取脉冲数\n",
    "                except (IndexError, ValueError) as e:\n",
    "                    print(f\"[ERROR] 解析电机{motor_number}速度时发生错误: {e}\")\n",
    "                    self.running = -1\n",
    "                    break\n",
    "\n",
    "                running_time = time.time() - cur_time  # 计算运行时间\n",
    "                try:\n",
    "                    self.motors_speed[num] = (ret_int / self.motor_pulse_per_round[num]) * 2 * MATH_PI * self.wheel_radius / running_time  # 计算电机速度，单位为m/s\n",
    "                except ZeroDivisionError as e:\n",
    "                    print(f\"[ERROR] 计算电机{motor_number}速度时发生错误: {e}\")\n",
    "                    self.running = -1\n",
    "                    break\n",
    "\n",
    "            running_time = time.time() - cur_time  # 计算运行时间\n",
    "            if running_time < running_time_set:  # 如果运行时间小于设置时间，则sleep一会儿\n",
    "                # print(\"[NO]\", running_time)\n",
    "                time.sleep(running_time_set - running_time)\n",
    "            else:\n",
    "                # print(\"[OVER]\", running_time)\n",
    "                pass\n",
    "\n",
    "        if self.running == -1:\n",
    "            print(\"[INFO] 线程被强制停止\")\n",
    "\n",
    "    def set_motor_speed(self, motor_id, speed_pwm):\n",
    "        \"\"\"\n",
    "        设置电机速度, 单位为PWM值(500-2500)\n",
    "        \"\"\"\n",
    "        if motor_id < 0 or motor_id > 3:\n",
    "            print(f\"[ERROR] 电机编号{motor_id}超出范围\")\n",
    "            return\n",
    "        if speed_pwm < 500 or speed_pwm > 2500:\n",
    "            print(f\"[ERROR] ID{motor_id}电机速度{speed_pwm}超出范围\")\n",
    "            return\n",
    "        if speed_pwm == 1500:\n",
    "            self.motor_direction[motor_id] = 0\n",
    "        elif speed_pwm > 1500:\n",
    "            self.motor_direction[motor_id] = 1\n",
    "        elif speed_pwm < 1500:\n",
    "            self.motor_direction[motor_id] = -1\n",
    "        self.motor_pwms[motor_id] = speed_pwm\n",
    "\n",
    "    def get_motor_speed(self, motor_id):\n",
    "        \"\"\"\n",
    "        获取指定电机速度, 单位为m/s\n",
    "        \"\"\"\n",
    "        return self.motors_speed[motor_id]\n",
    "    \n",
    "    def get_motors_speed(self):\n",
    "        \"\"\"\n",
    "        获取四个电机速度, 单位为m/s\n",
    "        \"\"\"\n",
    "        return self.motors_speed\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[INFO] 串口连接初始化完成\n"
     ]
    }
   ],
   "source": [
    "import tkinter as tk\n",
    "from tkinter import ttk\n",
    "import matplotlib\n",
    "from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk\n",
    "from matplotlib.figure import Figure\n",
    "import threading\n",
    "\n",
    "# 初始化matplotlib的图形和轴对象\n",
    "fig = Figure()\n",
    "ax = fig.add_subplot(111)\n",
    "motor_pwm=[1500, 1500, 1500, 1500]\n",
    "motor_pulses_per_revolutions = [0,0,0,0]\n",
    "\n",
    "atcar=AtCar(\"COM3\")\n",
    "\n",
    "running=1\n",
    "\n",
    "\n",
    "def main():\n",
    "    def update_motor_pwm(event):\n",
    "        global motor_pwm\n",
    "        # 获取滑块的值并更新motor_pwm\n",
    "        motor_pwm = [scale1.get(), scale2.get(), scale3.get(), scale4.get()]\n",
    "        # print(f\"Motor PWM Values: {motor_pwm}\")\n",
    "        atcar.set_motors_pwm(motor_pwm)\n",
    "        # print(f\"Motor PWM Values: {motor_pwm}\")\n",
    "\n",
    "    # 创建主窗口\n",
    "    root = tk.Tk()\n",
    "    root.title(\"Motor PWM Control\")\n",
    "\n",
    "    # 创建四个滑块\n",
    "    scale1 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 1 PWM\")\n",
    "    scale1.set(1500)  # 设置初始值\n",
    "    scale1.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale2 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 2 PWM\")\n",
    "    scale2.set(1500)  # 设置初始值\n",
    "    scale2.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale3 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 3 PWM\")\n",
    "    scale3.set(1500)  # 设置初始值\n",
    "    scale3.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    scale4 = tk.Scale(root, from_=500, to=2500, orient=tk.HORIZONTAL, label=\"Motor 4 PWM\")\n",
    "    scale4.set(1500)  # 设置初始值\n",
    "    scale4.pack(fill=tk.X, padx=20, pady=5)\n",
    "\n",
    "    # 创建一个按钮，用于更新motor_pwm值\n",
    "    update_button = tk.Button(root, text=\"Update PWM\", command=update_motor_pwm)\n",
    "    update_button.pack(pady=10)\n",
    "\n",
    "    # 绑定事件处理函数:当滑块的值发生变化时，调用update_motor_pwm函数\n",
    "    scale1.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale2.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale3.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    scale4.bind(\"<B1-Motion>\", update_motor_pwm)\n",
    "    \n",
    "    # 创建一个Frame用于放置matplotlib的画布和工具栏\n",
    "    frame = tk.Frame(root)\n",
    "    frame.pack(fill=tk.BOTH, expand=1)\n",
    "\n",
    "    # 将matplotlib的画布嵌入到Tkinter窗口中\n",
    "    canvas = FigureCanvasTkAgg(fig, master=frame)  # 传入Figure对象和Frame对象\n",
    "    canvas.draw()\n",
    "    canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)\n",
    "\n",
    "    # 创建matplotlib的工具栏，并添加到Frame中\n",
    "    toolbar = NavigationToolbar2Tk(canvas, frame)  # 传入canvas和Frame对象\n",
    "    toolbar.update()\n",
    "    canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)\n",
    "    \n",
    "    def update_plot():\n",
    "        global motor_pwm, motor_pulses_per_revolutions, running\n",
    "        # 更新图形\n",
    "        ax.clear()\n",
    "        ax.plot(motor_pulses_per_revolutions, motor_pwm, 'ro')\n",
    "        ax.set_xlabel('Motor Pulses per Revolution')\n",
    "        ax.set_ylabel('Motor PWM')\n",
    "        canvas.draw()\n",
    "        # 更新数据\n",
    "        motor_pulses_per_revolutions = atcar.get_motors_raw_speed()\n",
    "        \n",
    "    def update_plot_loop():\n",
    "        global running\n",
    "        while True:\n",
    "            if running==1:\n",
    "                update_plot()\n",
    "                time.sleep(0.1)\n",
    "\n",
    "    # 创建一个线程，用于更新图形\n",
    "    plot_thread = threading.Thread(target=update_plot_loop)\n",
    "    plot_thread.start()\n",
    "\n",
    "\n",
    "    # 运行主循环\n",
    "    root.mainloop()\n",
    "    running=0\n",
    "    plot_thread.join()\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    main()\n",
    "    running=0\n",
    "    atcar.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'code': 0, 'message': 'OK', 'data': 0}\n"
     ]
    }
   ],
   "source": [
    "import requests\n",
    "\n",
    "def send_message(uid, topic, type, msg, wemsg=None):\n",
    "    \"\"\"\n",
    "    发送消息到巴法云API。\n",
    "\n",
    "    :param uid: 用户私钥\n",
    "    :param topic: 主题名\n",
    "    :param type: 主题类型\n",
    "    :param msg: 要推送的消息\n",
    "    :param wemsg: 发送到微信的消息（可选）\n",
    "    :return: API响应的JSON数据\n",
    "    \"\"\"\n",
    "    url = \"https://apis.bemfa.com/va/postJsonMsg\"\n",
    "    headers = {\n",
    "        \"Content-Type\": \"application/json; charset=utf-8\"\n",
    "    }\n",
    "    payload = {\n",
    "        \"uid\": uid,\n",
    "        \"topic\": topic,\n",
    "        \"type\": type,\n",
    "        \"msg\": msg\n",
    "    }\n",
    "    if wemsg is not None:\n",
    "        payload[\"wemsg\"] = wemsg\n",
    "\n",
    "    try:\n",
    "        response = requests.post(url, headers=headers, json=payload)\n",
    "        response.raise_for_status()  # 如果响应状态码不是200，将抛出HTTPError异常\n",
    "        return response.json()  # 返回JSON格式的响应数据\n",
    "    except requests.exceptions.HTTPError as errh:\n",
    "        return {\"error\": \"Http Error: \" + str(errh)}\n",
    "    except requests.exceptions.ConnectionError as errc:\n",
    "        return {\"error\": \"Error Connecting: \" + str(errc)}\n",
    "    except requests.exceptions.Timeout as errt:\n",
    "        return {\"error\": \"Timeout Error: \" + str(errt)}\n",
    "    except requests.exceptions.RequestException as err:\n",
    "        return {\"error\": \"OOps: Something Else\" + str(err)}\n",
    "\n",
    "# 使用示例\n",
    "uid = \"4dc70bf0689849ad8216c674b7b9a6b9\"\n",
    "topic = \"setMotorData\"\n",
    "type = 3\n",
    "msg = \"1500150015001500\"\n",
    "response = send_message(uid, topic, type, msg)\n",
    "print(response)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
